[mutter] window-wayland: Don't send 1x1 sizes to GTK+ windows



commit d61dde12cbdbb33bc9fcbba8e785c1d66c4a0a5e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Sep 16 21:09:13 2014 -0600

    window-wayland: Don't send 1x1 sizes to GTK+ windows
    
    GTK+ requests get_xdg_surface before attaching a buffer, and since it
    might take a long time for GTK+ to get around to attaching a buffer and
    committing it, our idle for MOVE_RESIZE will kick in beforehand.
    
    And our idle will try to resize the 0x0 window that currently exists,
    constrain it to 1x1, which will send a configure event of 1x1 to the
    window while it boots up, causing it to awkwardly resize to the minimum
    size of the window.
    
    Make sure that in this case, our idle doesn't cause any problems, and
    that we fizzle out any idles like this.
    
    The "proper" way to do this would be to delay the creation of the
    MetaWindow until a surface is committed, but that's difficult for a
    variety of reasons, and might cause unintended issues with focus.

 src/wayland/window-wayland.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index b8bd102..491faf6 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -188,6 +188,18 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
     }
   else
     {
+      /* If we get a 0x0 size, this means that we're trying to resize
+       * a surface that doesn't have any buffer attached. This can happen
+       * when a client requests an xdg surface before bringing it up.
+       * The constrained_rect will be 1x1 because of how our constraints
+       * code works, and sending that to the window would cause it to
+       * redraw itself, so just don't send anything. Pretend like this
+       * move_resize never happened.
+       */
+      if (unconstrained_rect.width == 0 &&
+          unconstrained_rect.height == 0)
+        return;
+
       if (constrained_rect.width != window->rect.width ||
           constrained_rect.height != window->rect.height)
         {
@@ -296,8 +308,8 @@ meta_window_wayland_new (MetaDisplay        *display,
 
   attrs.x = 0;
   attrs.y = 0;
-  attrs.width = 1;
-  attrs.height = 1;
+  attrs.width = 0;
+  attrs.height = 0;
   attrs.border_width = 0;
   attrs.depth = 24;
   attrs.visual = NULL;


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