Skip to content

Commit

Permalink
Make window overview public
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Jan 21, 2024
1 parent 78d7f42 commit 4ca5738
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 11 additions & 3 deletions src/DesktopIntegration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ public class Gala.DesktopIntegration : GLib.Object {
}

public void show_windows_for (string app_id) throws IOError, DBusError {
if (wm.window_overview == null) {
throw new IOError.FAILED ("Window overview not provided by window manager");
}

App app;
if ((app = AppSystem.get_default ().lookup_app (app_id)) == null) {
throw new IOError.NOT_FOUND ("App not found");
Expand All @@ -111,9 +115,13 @@ public class Gala.DesktopIntegration : GLib.Object {
window_ids += window.get_id ();
}

var hash_table = new HashTable<string, Variant> (str_hash, str_equal);
hash_table["windows"] = window_ids;
var hints = new HashTable<string, Variant> (str_hash, str_equal);
hints["windows"] = window_ids;

if (wm.window_overview.is_opened ()) {
wm.window_overview.close ();
}

wm.show_window_spread (hash_table);
wm.window_overview.open (hints);
}
}
11 changes: 2 additions & 9 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ namespace Gala {
private Meta.PluginInfo info;

private WindowSwitcher? window_switcher = null;
private ActivatableComponent? window_overview = null;

public ActivatableComponent? window_overview { get; private set; }

public ScreenSaverManager? screensaver { get; private set; }

Expand Down Expand Up @@ -2427,14 +2428,6 @@ namespace Gala {
new_parent.add_child (actor);
actor.unref ();
}

public void show_window_spread (HashTable<string,Variant>? hints = null) {
if (window_overview.is_opened ()) {
window_overview.close ();
}

window_overview.open (hints);
}
}

[CCode (cname="clutter_x11_get_stage_window")]
Expand Down

0 comments on commit 4ca5738

Please sign in to comment.