mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
wayland/shell: Apply geometry after subsurface state application
The subsurface state may affect the geometry end result, e.g. when window decoration enlarging the toplevel window are applied. If we don't wait with calculating the window geometry, intersecting the set region with the subsurface tree extents will not include the subsurfaces. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/928 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1295
This commit is contained in:

committed by
Robert Mader

parent
be59b514ca
commit
d6af59612c
@ -746,8 +746,6 @@ meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWindow *window;
|
||||
MetaRectangle old_geometry;
|
||||
gboolean geometry_changed;
|
||||
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
@ -764,8 +762,6 @@ meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
return;
|
||||
}
|
||||
|
||||
old_geometry = xdg_surface_priv->geometry;
|
||||
|
||||
surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class);
|
||||
surface_role_class->apply_state (surface_role, pending);
|
||||
@ -779,6 +775,31 @@ meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
meta_wayland_window_configuration_free (configuration);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_xdg_toplevel_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceState *pending)
|
||||
{
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
|
||||
MetaWaylandXdgSurfacePrivate *xdg_surface_priv =
|
||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class;
|
||||
MetaWindow *window;
|
||||
MetaRectangle old_geometry;
|
||||
gboolean geometry_changed;
|
||||
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
old_geometry = xdg_surface_priv->geometry;
|
||||
|
||||
surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class);
|
||||
surface_role_class->post_apply_state (surface_role, pending);
|
||||
|
||||
if (!pending->newly_attached)
|
||||
return;
|
||||
@ -938,6 +959,7 @@ meta_wayland_xdg_toplevel_class_init (MetaWaylandXdgToplevelClass *klass)
|
||||
|
||||
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
|
||||
surface_role_class->apply_state = meta_wayland_xdg_toplevel_apply_state;
|
||||
surface_role_class->post_apply_state = meta_wayland_xdg_toplevel_post_apply_state;
|
||||
surface_role_class->get_toplevel = meta_wayland_xdg_toplevel_get_toplevel;
|
||||
|
||||
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
|
||||
@ -1092,10 +1114,6 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class;
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWindow *window;
|
||||
MetaRectangle buffer_rect;
|
||||
MetaWindow *parent_window;
|
||||
MetaRectangle parent_buffer_rect;
|
||||
|
||||
if (xdg_popup->setup.parent_surface)
|
||||
finish_popup_setup (xdg_popup);
|
||||
@ -1118,8 +1136,23 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
"Can't commit buffer to dismissed popup");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_xdg_popup_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceState *pending)
|
||||
{
|
||||
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (surface_role);
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_popup_parent_class);
|
||||
MetaWindow *window;
|
||||
MetaWindow *parent_window;
|
||||
MetaRectangle buffer_rect;
|
||||
MetaRectangle parent_buffer_rect;
|
||||
|
||||
/* If the window disappeared the surface is not coming back. */
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
@ -1130,6 +1163,8 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
if (!surface->buffer_ref->buffer)
|
||||
return;
|
||||
|
||||
surface_role_class->post_apply_state (surface_role, pending);
|
||||
|
||||
if (pending->has_acked_configure_serial)
|
||||
{
|
||||
MetaRectangle window_geometry;
|
||||
@ -1326,6 +1361,7 @@ meta_wayland_xdg_popup_class_init (MetaWaylandXdgPopupClass *klass)
|
||||
|
||||
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
|
||||
surface_role_class->apply_state = meta_wayland_xdg_popup_apply_state;
|
||||
surface_role_class->post_apply_state = meta_wayland_xdg_popup_post_apply_state;
|
||||
surface_role_class->get_toplevel = meta_wayland_xdg_popup_get_toplevel;
|
||||
|
||||
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
|
||||
@ -1500,8 +1536,6 @@ meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceState *pending)
|
||||
{
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
|
||||
MetaWaylandShellSurface *shell_surface =
|
||||
META_WAYLAND_SHELL_SURFACE (xdg_surface);
|
||||
MetaWaylandXdgSurfacePrivate *priv =
|
||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
@ -1522,8 +1556,17 @@ meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
|
||||
if (surface->buffer_ref->buffer)
|
||||
priv->first_buffer_attached = TRUE;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_xdg_surface_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceState *pending)
|
||||
{
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
|
||||
MetaWaylandXdgSurfacePrivate *priv =
|
||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
||||
MetaWaylandShellSurface *shell_surface =
|
||||
META_WAYLAND_SHELL_SURFACE (surface_role);
|
||||
|
||||
if (pending->has_new_geometry)
|
||||
{
|
||||
@ -1676,6 +1719,7 @@ meta_wayland_xdg_surface_class_init (MetaWaylandXdgSurfaceClass *klass)
|
||||
|
||||
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
|
||||
surface_role_class->apply_state = meta_wayland_xdg_surface_apply_state;
|
||||
surface_role_class->post_apply_state = meta_wayland_xdg_surface_post_apply_state;
|
||||
surface_role_class->assigned = meta_wayland_xdg_surface_assigned;
|
||||
|
||||
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
|
||||
|
Reference in New Issue
Block a user