[gtk+] ignore size inc when maximized/fullscreen



commit c806f9b7090d5fb63e7db2067baa012b1da460c8
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Tue Jun 23 11:54:48 2015 +0200

    ignore size inc when maximized/fullscreen
    
    Under Wayland, fullscreen/maximized windows may not cover the entire
    area when a size increment is specified.
    
    Ignore size increments for fullscreen/maximized windows just like most
    window managers do under X11 so that windows with size increments can
    still be fullscreen or fully maximized under Wayland as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751368

 gdk/wayland/gdkwindow-wayland.c |   30 ++++++++++++++++++------------
 gtk/gtkwindow.c                 |   11 ++++++++++-
 2 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index e97175d..d5880b6 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -914,18 +914,6 @@ xdg_surface_configure (void               *data,
   GdkWindowState new_state = 0;
   uint32_t *p;
 
-  if (width > 0 && height > 0)
-    {
-      gdk_window_constrain_size (&impl->geometry_hints,
-                                 impl->geometry_mask,
-                                 width + impl->margin_left + impl->margin_right,
-                                 height + impl->margin_top + impl->margin_bottom,
-                                 &width,
-                                 &height);
-
-      gdk_wayland_window_configure (window, width, height, impl->scale);
-    }
-
   wl_array_for_each (p, states)
     {
       uint32_t state = *p;
@@ -948,6 +936,24 @@ xdg_surface_configure (void               *data,
         }
     }
 
+   if (width > 0 && height > 0)
+    {
+      GdkWindowHints geometry_mask = impl->geometry_mask;
+
+      /* Ignore size increments for maximized/fullscreen windows */
+      if (new_state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN))
+        geometry_mask &= ~GDK_HINT_RESIZE_INC;
+
+      gdk_window_constrain_size (&impl->geometry_hints,
+                                 geometry_mask,
+                                 width + impl->margin_left + impl->margin_right,
+                                 height + impl->margin_top + impl->margin_bottom,
+                                 &width,
+                                 &height);
+
+      gdk_wayland_window_configure (window, width, height, impl->scale);
+    }
+
   GDK_NOTE (EVENTS,
             g_message ("configure, window %p %dx%d,%s%s%s",
                        window, width, height,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 799f3aa..e0d6e8b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -9582,7 +9582,16 @@ gtk_window_constrain_size (GtkWindow   *window,
                           gint        *new_width,
                           gint        *new_height)
 {
-  gdk_window_constrain_size (geometry, flags, width, height,
+  GtkWindowPrivate *priv = window->priv;
+  guint geometry_flags;
+
+  /* ignore size increments for maximized/fullscreen windows */
+  if (priv->maximized || priv->fullscreen)
+    geometry_flags = flags & ~GDK_HINT_RESIZE_INC;
+  else
+    geometry_flags = flags;
+
+  gdk_window_constrain_size (geometry, geometry_flags, width, height,
                              new_width, new_height);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]