11/*
22 * Copyright 2012 Tom Beckmann
33 * Copyright 2012 Rico Tzschichholz
4- * Copyright 2023 elementary, Inc. <https://elementary.io>
4+ * Copyright 2023-2025 elementary, Inc. <https://elementary.io>
55 * SPDX-License-Identifier: GPL-3.0-or-later
66 */
77
@@ -15,10 +15,8 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
1515
1616 private GestureController gesture_controller; // Currently not used for actual touchpad gestures but only as controller
1717
18+ private Clutter . Actor monitors;
1819 private ModalProxy modal_proxy;
19- // the workspaces which we expose right now
20- private List<Meta . Workspace > workspaces;
21- private WindowCloneContainer window_clone_container;
2220
2321 private uint64 []? window_ids = null ;
2422
@@ -33,15 +31,18 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
3331 enabled = false
3432 };
3533 add_gesture_controller (gesture_controller);
36- }
3734
35+ monitors = new ActorTarget ();
36+ add_child (monitors);
37+ }
3838
3939 public override bool key_press_event (Clutter .Event event ) {
4040 if (! is_opened ()) {
4141 return Clutter . EVENT_PROPAGATE ;
4242 }
4343
44- return window_clone_container. key_press_event (event);
44+ // TODO: Navigating between monitors
45+ return get_child_at_index (wm. get_display (). get_primary_monitor ()). key_press_event (event);
4546 }
4647
4748 public override bool button_release_event (Clutter .Event event ) {
@@ -63,40 +64,30 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
6364 * {@inheritDoc }
6465 */
6566 public void open (HashTable<string,Variant > ? hints = null ) {
66- workspaces = new List<Meta . Workspace > ();
67- unowned var manager = wm. get_display (). get_workspace_manager ();
68- foreach (unowned var workspace in manager. get_workspaces ()) {
69- workspaces. append (workspace);
67+ if (visible) {
68+ return ;
7069 }
7170
7271 window_ids = hints != null && " windows" in hints ? (uint64 []) hints[" windows" ] : null ;
7372
7473 var windows = new List<Meta . Window > ();
75- foreach (var workspace in workspaces) {
76- foreach (unowned var window in workspace. list_windows ()) {
77- if (window. window_type == Meta . WindowType . DOCK || NotificationStack . is_notification (window) ) {
78- continue ;
79- }
80-
81- if (window. window_type != Meta . WindowType . NORMAL &&
82- window. window_type != Meta . WindowType . DIALOG ||
83- window. is_attached_dialog () ||
84- (window_ids != null && ! (window. get_id () in window_ids))
85- ) {
86- unowned var actor = (Meta . WindowActor ) window. get_compositor_private ();
87- actor. hide ();
88-
89- continue ;
90- }
91-
92- // skip windows that are on all workspace except we're currently
93- // processing the workspace it actually belongs to
94- if (window. on_all_workspaces && window. get_workspace () != workspace) {
95- continue ;
96- }
97-
98- windows. append (window);
74+ foreach (unowned var window_actor in wm. get_display (). get_window_actors ()) {
75+ var window = window_actor. meta_window;
76+ if (ShellClientsManager . get_instance (). is_positioned_window (window)) {
77+ continue ;
78+ }
79+
80+ if (window. window_type != Meta . WindowType . NORMAL &&
81+ window. window_type != Meta . WindowType . DIALOG ||
82+ window. is_attached_dialog () ||
83+ window_ids != null && ! (window. get_id () in window_ids)
84+ ) {
85+ window_actor. hide ();
86+
87+ continue ;
9988 }
89+
90+ windows. append (window);
10091 }
10192
10293 if (windows. is_empty ()) {
@@ -119,7 +110,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
119110 var model = new WindowListModel (display, STACKING , true , i, null , custom_filter);
120111 model. items_changed. connect (on_items_changed);
121112
122- window_clone_container = new WindowCloneContainer (wm, model, scale, true ) {
113+ var window_clone_container = new WindowCloneContainer (wm, model, scale, true ) {
123114 padding_top = TOP_GAP ,
124115 padding_left = BORDER ,
125116 padding_right = BORDER ,
@@ -132,7 +123,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
132123 window_clone_container. window_selected. connect (thumb_selected);
133124 window_clone_container. requested_close. connect (() = > close ());
134125
135- add_child (window_clone_container);
126+ monitors . add_child (window_clone_container);
136127 }
137128
138129 visible = true ;
@@ -202,20 +193,14 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
202193 return ;
203194 }
204195
205- #if HAS_MUTTER48
206- GLib . Timeout . add (MultitaskingView . ANIMATION_DURATION , () = > {
207- #else
208- Clutter . Threads . Timeout . add (MultitaskingView . ANIMATION_DURATION , () = > {
209- #endif
210- cleanup ();
211-
212- return Source . REMOVE ;
213- });
214-
215196 gesture_controller. goto (0 );
216197 }
217198
218- private void cleanup () {
199+ public override void end_progress (GestureAction action ) {
200+ if (action != MULTITASKING_VIEW || get_current_commit (MULTITASKING_VIEW ) > 0.5 ) {
201+ return ;
202+ }
203+
219204 visible = false ;
220205
221206 wm. pop_modal (modal_proxy);
@@ -226,6 +211,6 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
226211 }
227212 }
228213
229- destroy_all_children ();
214+ monitors . remove_all_children ();
230215 }
231216}
0 commit comments