wayland/actor-surface: Update outputs on stage-views changes

ClutterActors new "stage-views-changed" signal fits pretty well for the
updating of wl_outputs a MetaWaylandActorSurface is on: With that signal
we get notified if the surface moved to a different CRTC, of which every
output has at least one.

So start listening to that signal, which fixes a bug where the wl_output
of a surface changes, but its allocation remains the same (which means
no signals triggering an update of the outputs will be emitted) and no
enter/leave events for the new wl_outputs are sent to the client. This
can happen when a monitor is hotplugged but the new allocation is
exactly the same as the old one even though it's on a different monitor.

Since the "stage-views-on-changed" signal will also get emitted when a
parent actor of the surface is moved, this means we can now remove the
call to meta_wayland_surface_update_outputs_recursively() on window
position changes or the completion of window-effects.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1358
This commit is contained in:
Jonas Dreßler 2020-03-12 23:35:28 +01:00 committed by Robert Mader
parent f552ed1303
commit abdbc14ca8
3 changed files with 6 additions and 32 deletions

View File

@ -76,6 +76,9 @@ clear_surface_actor (MetaWaylandActorSurface *actor_surface)
g_signal_handlers_disconnect_by_func (priv->actor, g_signal_handlers_disconnect_by_func (priv->actor,
meta_wayland_surface_update_outputs_recursively, meta_wayland_surface_update_outputs_recursively,
surface); surface);
g_signal_handlers_disconnect_by_func (priv->actor,
meta_wayland_surface_update_outputs,
surface);
g_clear_object (&priv->actor); g_clear_object (&priv->actor);
} }
@ -445,4 +448,7 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
g_signal_connect_swapped (priv->actor, "notify::mapped", g_signal_connect_swapped (priv->actor, "notify::mapped",
G_CALLBACK (meta_wayland_surface_update_outputs_recursively), G_CALLBACK (meta_wayland_surface_update_outputs_recursively),
surface); surface);
g_signal_connect_swapped (priv->actor, "stage-views-changed",
G_CALLBACK (meta_wayland_surface_update_outputs),
surface);
} }

View File

@ -37,7 +37,6 @@ typedef struct _MetaWaylandShellSurfacePrivate
MetaWindow *window; MetaWindow *window;
gulong unmanaging_handler_id; gulong unmanaging_handler_id;
gulong position_changed_handler_id;
gulong effects_completed_handler_id; gulong effects_completed_handler_id;
} MetaWaylandShellSurfacePrivate; } MetaWaylandShellSurfacePrivate;
@ -107,8 +106,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->position_changed_handler_id,
priv->window);
g_clear_signal_handler (&priv->effects_completed_handler_id, g_clear_signal_handler (&priv->effects_completed_handler_id,
meta_window_actor_from_window (priv->window)); meta_window_actor_from_window (priv->window));
priv->window = NULL; priv->window = NULL;
@ -127,18 +124,10 @@ window_unmanaging (MetaWindow *window,
clear_window (shell_surface); clear_window (shell_surface);
} }
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
}
static void static void
window_actor_effects_completed (MetaWindowActor *window_actor, window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
{ {
meta_wayland_surface_update_outputs_recursively (surface);
meta_wayland_compositor_repick (surface->compositor); meta_wayland_compositor_repick (surface->compositor);
} }
@ -167,11 +156,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->position_changed_handler_id =
g_signal_connect (window,
"position-changed",
G_CALLBACK (window_position_changed),
surface);
priv->effects_completed_handler_id = priv->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window), g_signal_connect (meta_window_actor_from_window (window),
"effects-completed", "effects-completed",

View File

@ -44,7 +44,6 @@ struct _MetaXwaylandSurface
MetaWindow *window; MetaWindow *window;
gulong unmanaging_handler_id; gulong unmanaging_handler_id;
gulong position_changed_handler_id;
gulong effects_completed_handler_id; gulong effects_completed_handler_id;
}; };
@ -67,8 +66,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);
g_clear_signal_handler (&xwayland_surface->position_changed_handler_id,
xwayland_surface->window);
window_actor = meta_window_actor_from_window (xwayland_surface->window); window_actor = meta_window_actor_from_window (xwayland_surface->window);
g_clear_signal_handler (&xwayland_surface->effects_completed_handler_id, g_clear_signal_handler (&xwayland_surface->effects_completed_handler_id,
@ -91,18 +88,10 @@ window_unmanaging (MetaWindow *window,
clear_window (xwayland_surface); clear_window (xwayland_surface);
} }
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
}
static void static void
window_actor_effects_completed (MetaWindowActor *window_actor, window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
{ {
meta_wayland_surface_update_outputs_recursively (surface);
meta_wayland_compositor_repick (surface->compositor); meta_wayland_compositor_repick (surface->compositor);
} }
@ -142,11 +131,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->position_changed_handler_id =
g_signal_connect (window,
"position-changed",
G_CALLBACK (window_position_changed),
surface);
xwayland_surface->effects_completed_handler_id = xwayland_surface->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window), g_signal_connect (meta_window_actor_from_window (window),
"effects-completed", "effects-completed",