fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-window-enable-resize-handles-for-non-CSD-custom-titl.patch

7020a8
From b33c9d95679725565a1c8428af69437e8fc00cdf Mon Sep 17 00:00:00 2001
7020a8
From: Ray Strode <rstrode@redhat.com>
7020a8
Date: Wed, 5 Apr 2017 16:32:39 -0400
7020a8
Subject: [PATCH] window: enable resize handles for non-CSD custom titlebars
7020a8
7020a8
If an an application has a custom titlebar, but the platform
7020a8
doesn't support client side decorations, GTK+ currently compromises
7020a8
by having the WM draw the border, and having the application draw
7020a8
the titlebar at the top of the client window.
7020a8
7020a8
Unfortunately, GTK+ neglects to tell the window manager to make the
7020a8
window resizable in that corner case.
7020a8
7020a8
This commit fixes that.
7020a8
---
7020a8
 gtk/gtkwindow.c | 4 ++--
7020a8
 1 file changed, 2 insertions(+), 2 deletions(-)
7020a8
7020a8
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
7020a8
index a68ed94962..cf4f426bde 100644
7020a8
--- a/gtk/gtkwindow.c
7020a8
+++ b/gtk/gtkwindow.c
7020a8
@@ -4051,61 +4051,61 @@ _gtk_window_titlebar_shows_app_menu (GtkWindow *window)
7020a8
  * On Windows, this function always works, since there’s no window manager
7020a8
  * policy involved.
7020a8
  * 
7020a8
  **/
7020a8
 void
7020a8
 gtk_window_set_decorated (GtkWindow *window,
7020a8
                           gboolean   setting)
7020a8
 {
7020a8
   GtkWindowPrivate *priv;
7020a8
   GdkWindow *gdk_window;
7020a8
 
7020a8
   g_return_if_fail (GTK_IS_WINDOW (window));
7020a8
 
7020a8
   priv = window->priv;
7020a8
 
7020a8
   setting = setting != FALSE;
7020a8
 
7020a8
   if (setting == priv->decorated)
7020a8
     return;
7020a8
 
7020a8
   priv->decorated = setting;
7020a8
 
7020a8
   gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
7020a8
   if (gdk_window)
7020a8
     {
7020a8
       if (priv->decorated)
7020a8
         {
7020a8
           if (priv->client_decorated)
7020a8
             gdk_window_set_decorations (gdk_window, 0);
7020a8
           else if (priv->custom_title)
7020a8
-            gdk_window_set_decorations (gdk_window, GDK_DECOR_BORDER);
7020a8
+            gdk_window_set_decorations (gdk_window, GDK_DECOR_BORDER | GDK_DECOR_RESIZEH);
7020a8
           else
7020a8
             gdk_window_set_decorations (gdk_window, GDK_DECOR_ALL);
7020a8
         }
7020a8
       else
7020a8
         gdk_window_set_decorations (gdk_window, 0);
7020a8
     }
7020a8
 
7020a8
   update_window_buttons (window);
7020a8
   gtk_widget_queue_resize (GTK_WIDGET (window));
7020a8
 
7020a8
   g_object_notify (G_OBJECT (window), "decorated");
7020a8
 }
7020a8
 
7020a8
 /**
7020a8
  * gtk_window_get_decorated:
7020a8
  * @window: a #GtkWindow
7020a8
  *
7020a8
  * Returns whether the window has been set to have decorations
7020a8
  * such as a title bar via gtk_window_set_decorated().
7020a8
  *
7020a8
  * Returns: %TRUE if the window has been set to have decorations
7020a8
  **/
7020a8
 gboolean
7020a8
 gtk_window_get_decorated (GtkWindow *window)
7020a8
 {
7020a8
   g_return_val_if_fail (GTK_IS_WINDOW (window), TRUE);
7020a8
 
7020a8
   return window->priv->decorated;
7020a8
 }
7020a8
 
7020a8
@@ -6976,61 +6976,61 @@ gtk_window_realize (GtkWidget *widget)
7020a8
       };
7020a8
 
7020a8
       attributes.wclass = GDK_INPUT_ONLY;
7020a8
       attributes.width = 1;
7020a8
       attributes.height = 1;
7020a8
       attributes.event_mask = GDK_BUTTON_PRESS_MASK;
7020a8
       attributes_mask = GDK_WA_CURSOR;
7020a8
 
7020a8
       for (i = 0; i < 8; i++)
7020a8
         {
7020a8
           attributes.cursor = gdk_cursor_new (cursor_type[i]);
7020a8
           priv->border_window[i] = gdk_window_new (gdk_window, &attributes, attributes_mask);
7020a8
           g_object_unref (attributes.cursor);
7020a8
 
7020a8
           gdk_window_show (priv->border_window[i]);
7020a8
           gtk_widget_register_window (widget, priv->border_window[i]);
7020a8
         }
7020a8
     }
7020a8
 
7020a8
   if (priv->transient_parent &&
7020a8
       gtk_widget_get_realized (GTK_WIDGET (priv->transient_parent)))
7020a8
     gdk_window_set_transient_for (gdk_window,
7020a8
                                   gtk_widget_get_window (GTK_WIDGET (priv->transient_parent)));
7020a8
 
7020a8
   if (priv->wm_role)
7020a8
     gdk_window_set_role (gdk_window, priv->wm_role);
7020a8
 
7020a8
   if (!priv->decorated || priv->client_decorated)
7020a8
     gdk_window_set_decorations (gdk_window, 0);
7020a8
   else if (priv->custom_title)
7020a8
-    gdk_window_set_decorations (gdk_window, GDK_DECOR_BORDER);
7020a8
+    gdk_window_set_decorations (gdk_window, GDK_DECOR_BORDER | GDK_DECOR_RESIZEH);
7020a8
 
7020a8
   if (!priv->deletable)
7020a8
     gdk_window_set_functions (gdk_window, GDK_FUNC_ALL | GDK_FUNC_CLOSE);
7020a8
 
7020a8
   if (gtk_window_get_skip_pager_hint (window))
7020a8
     gdk_window_set_skip_pager_hint (gdk_window, TRUE);
7020a8
 
7020a8
   if (gtk_window_get_skip_taskbar_hint (window))
7020a8
     gdk_window_set_skip_taskbar_hint (gdk_window, TRUE);
7020a8
 
7020a8
   if (gtk_window_get_accept_focus (window))
7020a8
     gdk_window_set_accept_focus (gdk_window, TRUE);
7020a8
   else
7020a8
     gdk_window_set_accept_focus (gdk_window, FALSE);
7020a8
 
7020a8
   if (gtk_window_get_focus_on_map (window))
7020a8
     gdk_window_set_focus_on_map (gdk_window, TRUE);
7020a8
   else
7020a8
     gdk_window_set_focus_on_map (gdk_window, FALSE);
7020a8
 
7020a8
   if (priv->modal)
7020a8
     gdk_window_set_modal_hint (gdk_window, TRUE);
7020a8
   else
7020a8
     gdk_window_set_modal_hint (gdk_window, FALSE);
7020a8
 
7020a8
   if (priv->startup_id)
7020a8
     {
7020a8
 #ifdef GDK_WINDOWING_X11
7020a8
       if (GDK_IS_X11_WINDOW (gdk_window))
7020a8
         {
7020a8
-- 
7020a8
2.12.2
7020a8