diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2020-11-12 14:06:43 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2020-11-12 15:07:30 +0100 |
commit | 067af969c03c31a2b7380b14f3344ef7d2258313 (patch) | |
tree | f21f9a86d4dfff7b10f621f2f742b0cfd95ae046 | |
parent | 29776c99a85c071c48336e04b6e8e7191b2bc3b5 (diff) | |
download | mutter-067af969c03c31a2b7380b14f3344ef7d2258313.tar.gz |
wayland/xdg-shell: Imitate undefined behavior Qt relies upon
Qt sets window geometry without in the same commit providing actual
content matching it, and relies on the compositor being able to adapt
without a new window geometry on a later commit. Other compositors do
this, so do the same, even though it's not guaranteed according to spec.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1557
(cherry picked from commit f5b44be9f22efd59b34dd8c3a98328306f979eea)
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1559
-rw-r--r-- | src/wayland/meta-wayland-xdg-shell.c | 13 | ||||
-rw-r--r-- | src/wayland/meta-window-wayland.c | 9 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 176f8a908..43505932d 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -89,6 +89,7 @@ typedef struct _MetaWaylandXdgSurfacePrivate struct wl_resource *resource; MetaWaylandXdgShellClient *shell_client; MetaRectangle geometry; + MetaRectangle unconstrained_geometry; guint configure_sent : 1; guint first_buffer_attached : 1; @@ -810,7 +811,7 @@ meta_wayland_xdg_toplevel_post_apply_state (MetaWaylandSurfaceRole *surface_rol META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class); surface_role_class->post_apply_state (surface_role, pending); - if (!pending->newly_attached) + if (!surface->buffer_ref->buffer) return; window_geometry = meta_wayland_xdg_surface_get_window_geometry (xdg_surface); @@ -1536,6 +1537,7 @@ meta_wayland_xdg_surface_real_reset (MetaWaylandXdgSurface *xdg_surface) priv->first_buffer_attached = FALSE; priv->configure_sent = FALSE; priv->geometry = (MetaRectangle) { 0 }; + priv->unconstrained_geometry = (MetaRectangle) { 0 }; priv->has_set_geometry = FALSE; } @@ -1578,12 +1580,19 @@ meta_wayland_xdg_surface_post_apply_state (MetaWaylandSurfaceRole *surface_role if (pending->has_new_geometry) { + priv->unconstrained_geometry = pending->new_geometry; meta_wayland_shell_surface_determine_geometry (shell_surface, &pending->new_geometry, &priv->geometry); priv->has_set_geometry = TRUE; } - else if (!priv->has_set_geometry) + else if (priv->has_set_geometry) + { + meta_wayland_shell_surface_determine_geometry (shell_surface, + &priv->unconstrained_geometry, + &priv->geometry); + } + else { MetaRectangle new_geometry = { 0 }; diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 4ddecb432..89ee0c292 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -999,7 +999,14 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, else { if (acked_configuration) - calculate_offset (acked_configuration, &new_geom, &rect); + { + calculate_offset (acked_configuration, &new_geom, &rect); + } + else + { + rect.x = window->rect.x; + rect.y = window->rect.y; + } } if (rect.x != window->rect.x || rect.y != window->rect.y) |