Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/DesktopIntegration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,12 @@ public class Gala.DesktopIntegration : GLib.Object {
throw new IOError.NOT_FOUND ("App not found");
}

var sorted_windows = wm.get_display ().sort_windows_by_stacking (app.get_windows ());

uint64[] window_ids = {};
foreach (var window in app.get_windows ()) {
foreach (var window in sorted_windows) {
window.raise ();
window.focus (Meta.CURRENT_TIME);
window_ids += window.get_id ();
}

Expand Down
92 changes: 44 additions & 48 deletions src/Widgets/WindowOverview.vala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2012 Tom Beckmann
* Copyright 2012 Rico Tzschichholz
* Copyright 2023 elementary, Inc. <https://elementary.io>
* Copyright 2023-2025 elementary, Inc. <https://elementary.io>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Expand All @@ -15,10 +15,9 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent

private GestureController gesture_controller; // Currently not used for actual touchpad gestures but only as controller

private Clutter.Actor background;
private Clutter.Actor monitors;
private ModalProxy modal_proxy;
// the workspaces which we expose right now
private List<Meta.Workspace> workspaces;
private WindowCloneContainer window_clone_container;

private uint64[]? window_ids = null;

Expand All @@ -33,15 +32,30 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
enabled = false
};
add_gesture_controller (gesture_controller);
}

background = new Clutter.Actor () {
#if HAS_MUTTER47
background_color = Cogl.Color.from_string ("black")
#else
background_color = Clutter.Color.from_string ("black")
#endif
};
background.add_constraint (new Clutter.BindConstraint (this, SIZE, 0));
add_child (background);

add_target (new PropertyTarget (MULTITASKING_VIEW, background, "opacity", typeof (uint), 0u, 150u));

monitors = new ActorTarget ();
add_child (monitors);
}

public override bool key_press_event (Clutter.Event event) {
if (!is_opened ()) {
return Clutter.EVENT_PROPAGATE;
}

return window_clone_container.key_press_event (event);
//TODO: Navigating between monitors
return get_child_at_index (wm.get_display ().get_primary_monitor ()).key_press_event (event);
}

public override bool button_release_event (Clutter.Event event) {
Expand All @@ -63,40 +77,28 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
* {@inheritDoc}
*/
public void open (HashTable<string,Variant>? hints = null) {
workspaces = new List<Meta.Workspace> ();
unowned var manager = wm.get_display ().get_workspace_manager ();
foreach (unowned var workspace in manager.get_workspaces ()) {
workspaces.append (workspace);
if (visible) {
return;
}

window_ids = hints != null && "windows" in hints ? (uint64[]) hints["windows"] : null;

var windows = new List<Meta.Window> ();
foreach (var workspace in workspaces) {
foreach (unowned var window in workspace.list_windows ()) {
if (window.window_type == Meta.WindowType.DOCK || NotificationStack.is_notification (window) ) {
continue;
}

if (window.window_type != Meta.WindowType.NORMAL &&
window.window_type != Meta.WindowType.DIALOG ||
window.is_attached_dialog () ||
(window_ids != null && !(window.get_id () in window_ids))
) {
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
actor.hide ();

continue;
}

// skip windows that are on all workspace except we're currently
// processing the workspace it actually belongs to
if (window.on_all_workspaces && window.get_workspace () != workspace) {
continue;
}

windows.append (window);
#if HAS_MUTTER48
foreach (unowned var window_actor in wm.get_display ().get_compositor ().get_window_actors ()) {
#else
foreach (unowned var window_actor in wm.get_display ().get_window_actors ()) {
#endif
var window = window_actor.meta_window;
if (ShellClientsManager.get_instance ().is_positioned_window (window) ||
window.window_type != NORMAL && window.window_type != DIALOG ||
window.is_attached_dialog () ||
window_ids != null && !(window.get_id () in window_ids)
) {
continue;
}

windows.append (window);
}

if (windows.is_empty ()) {
Expand All @@ -119,7 +121,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
var model = new WindowListModel (display, STACKING, true, i, null, custom_filter);
model.items_changed.connect (on_items_changed);

window_clone_container = new WindowCloneContainer (wm, model, scale, true) {
var window_clone_container = new WindowCloneContainer (wm, model, scale, true) {
padding_top = TOP_GAP,
padding_left = BORDER,
padding_right = BORDER,
Expand All @@ -132,7 +134,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
window_clone_container.window_selected.connect (thumb_selected);
window_clone_container.requested_close.connect (() => close ());

add_child (window_clone_container);
monitors.add_child (window_clone_container);
}

visible = true;
Expand Down Expand Up @@ -202,20 +204,14 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
return;
}

#if HAS_MUTTER48
GLib.Timeout.add (MultitaskingView.ANIMATION_DURATION, () => {
#else
Clutter.Threads.Timeout.add (MultitaskingView.ANIMATION_DURATION, () => {
#endif
cleanup ();

return Source.REMOVE;
});

gesture_controller.goto (0);
}

private void cleanup () {
public override void end_progress (GestureAction action) {
if (action != MULTITASKING_VIEW || get_current_commit (MULTITASKING_VIEW) > 0.5) {
return;
}

visible = false;

wm.pop_modal (modal_proxy);
Expand All @@ -226,6 +222,6 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
}
}

destroy_all_children ();
monitors.remove_all_children ();
}
}
16 changes: 8 additions & 8 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,20 @@ namespace Gala {
Meta.KeyBinding.set_custom_handler ("switch-group-backward", window_switcher.handle_switch_windows);
}

if (plugin_manager.window_overview_provider == null
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null
) {
window_overview = new WindowOverview (this);
ui_group.add_child ((Clutter.Actor) window_overview);
}

// Add the remaining components that should be on top
shell_group = new Clutter.Actor ();
ui_group.add_child (shell_group);

menu_group = new Clutter.Actor ();
ui_group.add_child (menu_group);

if (plugin_manager.window_overview_provider == null
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null
) {
window_overview = new WindowOverview (this);
ui_group.add_child ((Clutter.Actor) window_overview);
}

var feedback_group = display.get_compositor ().get_feedback_group ();
stage.remove_child (feedback_group);
ui_group.add_child (feedback_group);
Expand Down Expand Up @@ -1410,7 +1410,7 @@ namespace Gala {
return;
}

if (!Meta.Prefs.get_gnome_animations ()) {
if (!Meta.Prefs.get_gnome_animations () || !actor.visible) {
actor.opacity = 0;
destroy_completed (actor);

Expand Down