Avoid connecting multiple times to window_created (#1599)

This commit is contained in:
Leo 2023-03-30 19:25:41 +09:00 committed by GitHub
parent cf2b835641
commit 1a4c1e8f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,8 +111,6 @@ namespace Gala {
private GLib.Settings animations_settings;
private GLib.Settings behavior_settings;
private ulong workspace_switching_window_created_id = 0;
private GestureTracker gesture_tracker;
private bool animating_switch_workspace = false;
private bool switch_workspace_with_gesture = false;
@ -358,6 +356,20 @@ namespace Gala {
update_input_area ();
// while a workspace is being switched mutter doesn't map windows
// TODO: currently only notifications are handled here, other windows should be too
display.window_created.connect ((window) => {
if (!animating_switch_workspace) {
return;
}
if (window.window_type == Meta.WindowType.NOTIFICATION) {
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor, enable_animations);
}
});
stage.show ();
Idle.add (() => {
@ -1894,15 +1906,6 @@ namespace Gala {
}
}
workspace_switching_window_created_id = display.window_created.connect ((window) => {
if (window.window_type == Meta.WindowType.NOTIFICATION) {
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
// while a workspace is being switched mutter doesn't map windows
// TODO: currently only notifications are handled here, other windows should be too
clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor, enable_animations);
}
});
main_container.clip_to_allocation = true;
main_container.x = move_primary_only ? monitor_geom.x : 0.0f;
main_container.y = move_primary_only ? monitor_geom.y : 0.0f;
@ -2063,8 +2066,6 @@ namespace Gala {
}
}
display.disconnect (workspace_switching_window_created_id);
if (tmp_actors != null) {
foreach (var actor in tmp_actors) {
actor.destroy ();