wayland/subsurface: Keep subsurface actors reactive

The actors of Wayland subsurfaces are set to be reactive on creation,
when receiving the `wl_subcompositor.get_subsurface` request.

However, if a client creates several subsurfaces and then creates the
xdg_toplevel object after, the previous subsurface actors are reset.

As a result, Clutter picking will skip and ignore those actors in
`clutter_actor_should_pick_paint()` because they aren't marked as
reactive anymore.

An example of such a client being affected by this issue is SCTK, the
Rust library implementing client side decorations for Wayland used
internally by winit and alacritty.

Move the `set_reactive()` call from `get_subsurface()` to the subsurface
`sync_actor_subsurface_state()` vfunc to make sure those remain reactive
even after `xdg_surface.get_toplevel` is invoked.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1024
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1040
This commit is contained in:
Olivier Fourdan 2020-02-07 16:25:20 +01:00 committed by Jonas Ådahl
parent 264f68858a
commit 934a829a57

View File

@ -85,6 +85,7 @@ sync_actor_subsurface_state (MetaWaylandSurface *surface)
transform_subsurface_position (surface, &x, &y);
clutter_actor_set_position (actor, x, y);
clutter_actor_set_reactive (actor, TRUE);
if (surface->buffer_ref.buffer)
clutter_actor_show (actor);
@ -519,7 +520,6 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
MetaWaylandSurface *parent = wl_resource_get_user_data (parent_resource);
MetaWindow *toplevel_window;
MetaWindowActor *window_actor;
MetaSurfaceActor *surface_actor;
if (surface->wl_subsurface)
{
@ -567,9 +567,6 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
window_actor = meta_window_actor_wayland_from_surface (surface);
if (window_actor)
meta_window_actor_wayland_rebuild_surface_tree (window_actor);
surface_actor = meta_wayland_surface_get_actor (surface);
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), TRUE);
}
static const struct wl_subcompositor_interface meta_wayland_subcompositor_interface = {