compositor: Trigger repick after window effects here

Just because of implementation details, this is only relevant to Wayland,
and is done via ::effects-completed handlers there. Ideally, Clutter should
notice by itself about effects starting, finishing, and affecting picking.
Doing this in generic code seems slightly cleaner in the interim.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1654>
This commit is contained in:
Carlos Garnacho 2020-12-22 18:22:43 +01:00
parent b04e326572
commit a64dba4d7a
3 changed files with 12 additions and 37 deletions

View File

@ -659,16 +659,24 @@ meta_window_actor_after_effects (MetaWindowActor *self)
{ {
MetaWindowActorPrivate *priv = MetaWindowActorPrivate *priv =
meta_window_actor_get_instance_private (self); meta_window_actor_get_instance_private (self);
ClutterStage *stage;
ClutterSeat *seat;
stage = CLUTTER_STAGE (clutter_actor_get_stage (CLUTTER_ACTOR (self)));
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
if (priv->needs_destroy) if (priv->needs_destroy)
{ {
clutter_actor_destroy (CLUTTER_ACTOR (self)); clutter_actor_destroy (CLUTTER_ACTOR (self));
return; }
else
{
g_signal_emit (self, signals[EFFECTS_COMPLETED], 0);
meta_window_actor_sync_visibility (self);
meta_window_actor_sync_actor_geometry (self, FALSE);
} }
g_signal_emit (self, signals[EFFECTS_COMPLETED], 0); clutter_stage_repick_device (stage, clutter_seat_get_pointer (seat));
meta_window_actor_sync_visibility (self);
meta_window_actor_sync_actor_geometry (self, FALSE);
} }
void void

View File

@ -37,7 +37,6 @@ typedef struct _MetaWaylandShellSurfacePrivate
MetaWindow *window; MetaWindow *window;
gulong unmanaging_handler_id; gulong unmanaging_handler_id;
gulong effects_completed_handler_id;
} MetaWaylandShellSurfacePrivate; } MetaWaylandShellSurfacePrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWaylandShellSurface, G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWaylandShellSurface,
@ -106,8 +105,6 @@ clear_window (MetaWaylandShellSurface *shell_surface)
g_clear_signal_handler (&priv->unmanaging_handler_id, g_clear_signal_handler (&priv->unmanaging_handler_id,
priv->window); priv->window);
g_clear_signal_handler (&priv->effects_completed_handler_id,
meta_window_actor_from_window (priv->window));
priv->window = NULL; priv->window = NULL;
surface_actor = meta_wayland_surface_get_actor (surface); surface_actor = meta_wayland_surface_get_actor (surface);
@ -124,13 +121,6 @@ window_unmanaging (MetaWindow *window,
clear_window (shell_surface); clear_window (shell_surface);
} }
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface)
{
meta_wayland_compositor_repick (surface->compositor);
}
void void
meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface, meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
MetaWindow *window) MetaWindow *window)
@ -156,11 +146,6 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
"unmanaging", "unmanaging",
G_CALLBACK (window_unmanaging), G_CALLBACK (window_unmanaging),
shell_surface); shell_surface);
priv->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window),
"effects-completed",
G_CALLBACK (window_actor_effects_completed),
surface);
meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE); meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
} }

View File

@ -44,7 +44,6 @@ struct _MetaXwaylandSurface
MetaWindow *window; MetaWindow *window;
gulong unmanaging_handler_id; gulong unmanaging_handler_id;
gulong effects_completed_handler_id;
}; };
G_DEFINE_TYPE (MetaXwaylandSurface, G_DEFINE_TYPE (MetaXwaylandSurface,
@ -58,7 +57,6 @@ clear_window (MetaXwaylandSurface *xwayland_surface)
META_WAYLAND_SURFACE_ROLE (xwayland_surface); META_WAYLAND_SURFACE_ROLE (xwayland_surface);
MetaWaylandSurface *surface = MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role); meta_wayland_surface_role_get_surface (surface_role);
MetaWindowActor *window_actor;
MetaSurfaceActor *surface_actor; MetaSurfaceActor *surface_actor;
if (!xwayland_surface->window) if (!xwayland_surface->window)
@ -67,10 +65,6 @@ clear_window (MetaXwaylandSurface *xwayland_surface)
g_clear_signal_handler (&xwayland_surface->unmanaging_handler_id, g_clear_signal_handler (&xwayland_surface->unmanaging_handler_id,
xwayland_surface->window); xwayland_surface->window);
window_actor = meta_window_actor_from_window (xwayland_surface->window);
g_clear_signal_handler (&xwayland_surface->effects_completed_handler_id,
window_actor);
xwayland_surface->window->surface = NULL; xwayland_surface->window->surface = NULL;
xwayland_surface->window = NULL; xwayland_surface->window = NULL;
@ -88,13 +82,6 @@ window_unmanaging (MetaWindow *window,
clear_window (xwayland_surface); clear_window (xwayland_surface);
} }
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface)
{
meta_wayland_compositor_repick (surface->compositor);
}
void void
meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surface, meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surface,
MetaWindow *window) MetaWindow *window)
@ -131,11 +118,6 @@ meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surfa
"unmanaging", "unmanaging",
G_CALLBACK (window_unmanaging), G_CALLBACK (window_unmanaging),
xwayland_surface); xwayland_surface);
xwayland_surface->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window),
"effects-completed",
G_CALLBACK (window_actor_effects_completed),
surface);
g_signal_emit (xwayland_surface, signals[WINDOW_ASSOCIATED], 0); g_signal_emit (xwayland_surface, signals[WINDOW_ASSOCIATED], 0);