[mutter] window/wayland: Replace constraint side effect peeking with state checks



commit 9542c713ade1f4ff3b738faf1c27d5ae34d9a5f7
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Jul 2 10:25:49 2021 +0200

    window/wayland: Replace constraint side effect peeking with state checks
    
    When the MetaWindow resize machinery for toplevels ended up in the
    Wayland window implementation, we tried to avoid configuring
    not-yet-mapped windows that just had its zero sized dimension pass
    through the constraint machinery, resulting in a 1x1 sized window.
    
    If we'd properly set up the min size metadata earlier, that 1x1 would
    likely be the minimum size set of a window, which makes things harder to
    predict when peeking at side effects.
    
    However, what the side effect peeking intends to do, as documented in
    the comment, was to figure out when the client hadn't committed any
    buffer yet, i.e. during the initial map, and in those cases avoid
    sending that nasty 1x1 size, resulting in silly window sizes. A more
    robust way to detect this is instead checking when we shouldn't really
    try resize things our own way, and in those cases early out as was done
    before.
    
    This means that, for a yet to me mapped window, we only ever want to
    send an initial non-zero configuration when 1) it's initially maximized,
    2) initially fullscreen, or 3) initially tiled in any way, as those are
    the situations where the compositor is the one deciding the size.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1912>

 src/wayland/meta-window-wayland.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index 31e0ef1032..12e9567d9c 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -355,21 +355,10 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
         {
           MetaWaylandWindowConfiguration *configuration;
 
-          /* If the constrained size is 1x1 and the unconstrained size is 0x0
-           * it means that we are trying to resize a window where the client has
-           * not yet committed a buffer. The 1x1 constrained size is a result of
-           * how the constraints code works. Lets avoid trying to have the
-           * client configure itself to draw on a 1x1 surface.
-           *
-           * We cannot guard against only an empty unconstrained_rect here,
-           * because the client may have created a xdg surface without a buffer
-           * attached and asked it to be maximized. In such case we should let
-           * it know about the expected window geometry of a maximized window,
-           * even though there is currently no buffer attached. */
-          if (unconstrained_rect.width == 0 &&
-              unconstrained_rect.height == 0 &&
-              constrained_rect.width == 1 &&
-              constrained_rect.height == 1)
+          if (!meta_wayland_surface_get_buffer (window->surface) &&
+              !META_WINDOW_MAXIMIZED (window) &&
+              window->tile_mode == META_TILE_NONE &&
+              !meta_window_is_fullscreen (window))
             return;
 
           configuration =


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