compositor: Use direct access to disconnect top window actor signal

Everytime the top window changes we connect/disconnect to the actor's destroy
signal, although as explained in commit ba8f5a11 this might be slower in case
the window actor has many other signal connections.

So, just track this using an ID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
This commit is contained in:
Marco Trevisan (Treviño) 2019-06-28 19:33:40 +02:00
parent 7645c51c54
commit b850f5a732
2 changed files with 14 additions and 9 deletions

View File

@ -33,6 +33,7 @@ struct _MetaCompositor
CoglContext *context;
MetaWindowActor *top_window_actor;
gulong top_window_actor_destroy_id;
/* Used for unredirecting fullscreen windows */
guint disable_unredirect_count;

View File

@ -149,10 +149,10 @@ meta_compositor_destroy (MetaCompositor *compositor)
if (compositor->top_window_actor)
{
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed,
compositor);
g_signal_handler_disconnect (compositor->top_window_actor,
compositor->top_window_actor_destroy_id);
compositor->top_window_actor = NULL;
compositor->top_window_actor_destroy_id = 0;
}
g_clear_pointer (&compositor->window_group, clutter_actor_destroy);
@ -1025,6 +1025,7 @@ on_top_window_actor_destroyed (MetaWindowActor *window_actor,
MetaCompositor *compositor)
{
compositor->top_window_actor = NULL;
compositor->top_window_actor_destroy_id = 0;
compositor->windows = g_list_remove (compositor->windows, window_actor);
meta_stack_tracker_queue_sync_stack (compositor->display->stack_tracker);
@ -1124,16 +1125,19 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
return;
if (compositor->top_window_actor)
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed,
compositor);
{
g_signal_handler_disconnect (compositor->top_window_actor,
compositor->top_window_actor_destroy_id);
compositor->top_window_actor_destroy_id = 0;
}
compositor->top_window_actor = top_window_actor;
if (compositor->top_window_actor)
g_signal_connect (compositor->top_window_actor, "destroy",
G_CALLBACK (on_top_window_actor_destroyed),
compositor);
compositor->top_window_actor_destroy_id =
g_signal_connect (compositor->top_window_actor, "destroy",
G_CALLBACK (on_top_window_actor_destroyed),
compositor);
}
void