compositor: Only disconnect/connect top-window signals if it changed

If the stack changed but the top window didn't, there's no need to disconnect
the signal and connect it again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
This commit is contained in:
Marco Trevisan (Treviño) 2019-06-13 10:37:28 +02:00
parent f1837b785b
commit 7645c51c54

View File

@ -1034,6 +1034,7 @@ void
meta_compositor_sync_stack (MetaCompositor *compositor, meta_compositor_sync_stack (MetaCompositor *compositor,
GList *stack) GList *stack)
{ {
MetaWindowActor *top_window_actor;
GList *old_stack; GList *old_stack;
/* This is painful because hidden windows that we are in the process /* This is painful because hidden windows that we are in the process
@ -1117,12 +1118,17 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (compositor); sync_actor_stacking (compositor);
top_window_actor = get_top_visible_window_actor (compositor);
if (compositor->top_window_actor == top_window_actor)
return;
if (compositor->top_window_actor) if (compositor->top_window_actor)
g_signal_handlers_disconnect_by_func (compositor->top_window_actor, g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed, on_top_window_actor_destroyed,
compositor); compositor);
compositor->top_window_actor = get_top_visible_window_actor (compositor); compositor->top_window_actor = top_window_actor;
if (compositor->top_window_actor) if (compositor->top_window_actor)
g_signal_connect (compositor->top_window_actor, "destroy", g_signal_connect (compositor->top_window_actor, "destroy",