ignore size inc when maximized/fullscreen
authorOlivier Fourdan <ofourdan@redhat.com>
Tue, 23 Jun 2015 09:54:48 +0000 (11:54 +0200)
committerOlivier Fourdan <ofourdan@redhat.com>
Fri, 3 Jul 2015 14:21:13 +0000 (16:21 +0200)
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
gtk/gtkwindow.c

index e97175d707e8fc7ff372f5b729650dc43b9cf934..d5880b6e25a736e2d962b44535b2d6927083ba7b 100644 (file)
@@ -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,
index 799f3aaec52a3d4908ff8f4927a93e99374fb5d2..e0d6e8b3f8705bd23dcdb758a08db78628d69de7 100644 (file)
@@ -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);
 }