wayland: Compare geometries after chaining up
After 20176d03
, the Wayland backend only synchronizes with the
compositor after a geometry was set, and it was different from
the current geometry.
That commit was mistakenly comparing the geometry before chaining
up, which would yield a false negative on the case where the
client didn't call set_geometry() before commit().
Fix that by caching the old geometry locally, chain up (and thus
apply the new geometry rectangle), then comparing the old and
current geometry rectangles.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/150
This commit is contained in:
parent
c9c3283540
commit
cf734999fb
@ -585,17 +585,6 @@ is_new_size_hints_valid (MetaWindow *window,
|
|||||||
(new_max_height == 0 || new_min_height <= new_max_height));
|
(new_max_height == 0 || new_min_height <= new_max_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
did_geometry_change (MetaWaylandZxdgSurfaceV6 *xdg_surface,
|
|
||||||
MetaWaylandPendingState *pending)
|
|
||||||
{
|
|
||||||
MetaWaylandZxdgSurfaceV6Private *priv =
|
|
||||||
meta_wayland_zxdg_surface_v6_get_instance_private (xdg_surface);
|
|
||||||
|
|
||||||
return pending->has_new_geometry &&
|
|
||||||
!meta_rectangle_equal (&priv->geometry, &pending->new_geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
|
meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
|
||||||
MetaWaylandPendingState *pending)
|
MetaWaylandPendingState *pending)
|
||||||
@ -611,11 +600,10 @@ meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
meta_wayland_surface_role_get_surface (surface_role);
|
meta_wayland_surface_role_get_surface (surface_role);
|
||||||
MetaWindow *window = surface->window;
|
MetaWindow *window = surface->window;
|
||||||
MetaRectangle window_geometry;
|
MetaRectangle window_geometry;
|
||||||
|
MetaRectangle old_geometry;
|
||||||
gboolean geometry_changed;
|
gboolean geometry_changed;
|
||||||
|
|
||||||
/* This check must happen before chaining up, otherwise the new geometry
|
old_geometry = xdg_surface_priv->geometry;
|
||||||
* is applied and it'll always return FALSE. */
|
|
||||||
geometry_changed = did_geometry_change (xdg_surface, pending);
|
|
||||||
|
|
||||||
surface_role_class =
|
surface_role_class =
|
||||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_zxdg_toplevel_v6_parent_class);
|
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_zxdg_toplevel_v6_parent_class);
|
||||||
@ -634,6 +622,8 @@ meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
geometry_changed = !meta_rectangle_equal (&old_geometry, &xdg_surface_priv->geometry);
|
||||||
|
|
||||||
if (geometry_changed || meta_window_wayland_needs_move_resize (window))
|
if (geometry_changed || meta_window_wayland_needs_move_resize (window))
|
||||||
{
|
{
|
||||||
window_geometry =
|
window_geometry =
|
||||||
|
@ -608,17 +608,6 @@ is_new_size_hints_valid (MetaWindow *window,
|
|||||||
(new_max_height == 0 || new_min_height <= new_max_height));
|
(new_max_height == 0 || new_min_height <= new_max_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
did_geometry_change (MetaWaylandXdgSurface *xdg_surface,
|
|
||||||
MetaWaylandPendingState *pending)
|
|
||||||
{
|
|
||||||
MetaWaylandXdgSurfacePrivate *priv =
|
|
||||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
|
||||||
|
|
||||||
return pending->has_new_geometry &&
|
|
||||||
!meta_rectangle_equal (&priv->geometry, &pending->new_geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
|
meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
|
||||||
MetaWaylandPendingState *pending)
|
MetaWaylandPendingState *pending)
|
||||||
@ -632,6 +621,7 @@ meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
meta_wayland_surface_role_get_surface (surface_role);
|
meta_wayland_surface_role_get_surface (surface_role);
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
MetaRectangle window_geometry;
|
MetaRectangle window_geometry;
|
||||||
|
MetaRectangle old_geometry;
|
||||||
gboolean geometry_changed;
|
gboolean geometry_changed;
|
||||||
|
|
||||||
if (!surface->buffer_ref.buffer && xdg_surface_priv->first_buffer_attached)
|
if (!surface->buffer_ref.buffer && xdg_surface_priv->first_buffer_attached)
|
||||||
@ -641,10 +631,7 @@ meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
}
|
}
|
||||||
|
|
||||||
window = surface->window;
|
window = surface->window;
|
||||||
|
old_geometry = xdg_surface_priv->geometry;
|
||||||
/* This check must happen before chaining up, otherwise the new geometry
|
|
||||||
* is applied and it'll always return FALSE. */
|
|
||||||
geometry_changed = did_geometry_change (xdg_surface, pending);
|
|
||||||
|
|
||||||
surface_role_class =
|
surface_role_class =
|
||||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class);
|
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class);
|
||||||
@ -659,6 +646,8 @@ meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
if (!pending->newly_attached)
|
if (!pending->newly_attached)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
geometry_changed = !meta_rectangle_equal (&old_geometry, &xdg_surface_priv->geometry);
|
||||||
|
|
||||||
if (geometry_changed || meta_window_wayland_needs_move_resize (window))
|
if (geometry_changed || meta_window_wayland_needs_move_resize (window))
|
||||||
{
|
{
|
||||||
window_geometry = meta_wayland_xdg_surface_get_window_geometry (xdg_surface);
|
window_geometry = meta_wayland_xdg_surface_get_window_geometry (xdg_surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user