From b06b3137ac4fd2fe4f09c76e4d470abdb87d71f6 Mon Sep 17 00:00:00 2001 From: Tom Beckmann Date: Fri, 3 May 2013 18:53:49 +0200 Subject: [PATCH] Add watches for window_left_monitors to the places where we use window clones --- src/Plugin.vala | 2 +- src/Widgets/WindowOverview.vala | 14 ++++++++++++++ src/Widgets/WindowSwitcher.vala | 17 ++++++++++++++--- src/Widgets/WorkspaceThumb.vala | 8 ++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Plugin.vala b/src/Plugin.vala index 4fe3de1c..222752c5 100644 --- a/src/Plugin.vala +++ b/src/Plugin.vala @@ -60,7 +60,7 @@ namespace Gala Gee.HashSet unmaximizing = new Gee.HashSet (); Gee.HashSet mapping = new Gee.HashSet (); Gee.HashSet destroying = new Gee.HashSet (); - + public Plugin () { info = PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers", diff --git a/src/Widgets/WindowOverview.vala b/src/Widgets/WindowOverview.vala index 3e2a4648..418bead4 100644 --- a/src/Widgets/WindowOverview.vala +++ b/src/Widgets/WindowOverview.vala @@ -565,6 +565,8 @@ namespace Gala workspace.window_added.connect (add_window); workspace.window_removed.connect (remove_window); } + + screen.window_left_monitor.connect (window_left_monitor); #if HAS_MUTTER38 plugin.wallpaper. @@ -601,6 +603,17 @@ namespace Gala calculate_places (get_children ()); } + + void window_left_monitor (int num, Window window) + { + // see if that's happened on one of our workspaces + foreach (var workspace in workspaces) { + if (window.located_on_workspace (workspace)) { + remove_window (window); + return; + } + } + } void add_window (Window window) { @@ -681,6 +694,7 @@ namespace Gala workspace.window_added.disconnect (add_window); workspace.window_removed.disconnect (remove_window); } + screen.window_left_monitor.disconnect (window_left_monitor); ready = false; diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala index 08ff358a..4f83b27a 100644 --- a/src/Widgets/WindowSwitcher.vala +++ b/src/Widgets/WindowSwitcher.vala @@ -132,10 +132,7 @@ namespace Gala closing = true; var screen = plugin.get_screen (); - var workspace = screen.get_active_workspace (); - workspace.window_added.disconnect (add_window); - workspace.window_removed.disconnect (remove_window); if (dock_window != null) dock_window.opacity = 0; @@ -186,6 +183,10 @@ namespace Gala if (window.get_workspace () == workspace.index ()) window.show (); } + + workspace.window_added.disconnect (add_window); + workspace.window_removed.disconnect (remove_window); + screen.window_left_monitor.disconnect (window_left_monitor); }); } @@ -278,6 +279,15 @@ namespace Gala i++; } } + + void window_left_monitor (int num, Meta.Window window) + { + // see if that's happened on our workspace + var workspace = plugin.get_screen ().get_active_workspace (); + if (window.located_on_workspace (workspace)) { + remove_window (window); + } + } void add_window (Meta.Window window) { @@ -423,6 +433,7 @@ namespace Gala workspace.window_added.connect (add_window); workspace.window_removed.connect (remove_window); + screen.window_left_monitor.connect (window_left_monitor); //grab the windows to be switched var layout = dock.layout_manager as BoxLayout; diff --git a/src/Widgets/WorkspaceThumb.vala b/src/Widgets/WorkspaceThumb.vala index c7a2ca22..f2e9729e 100644 --- a/src/Widgets/WorkspaceThumb.vala +++ b/src/Widgets/WorkspaceThumb.vala @@ -78,6 +78,7 @@ namespace Gala workspace.window_added.connect (handle_window_added); workspace.window_removed.connect (handle_window_removed); + screen.window_left_monitor.connect (window_left_monitor); reactive = true; @@ -259,6 +260,7 @@ namespace Gala screen.workspace_switched.disconnect (handle_workspace_switched); screen.workspace_added.disconnect (workspace_added); screen.monitors_changed.disconnect (resize); + screen.window_left_monitor.disconnect (window_left_monitor); } void close_workspace (Clutter.Actor actor) @@ -329,6 +331,12 @@ namespace Gala check_last_workspace (); } + void window_left_monitor (int num, Meta.Window window) + { + if (window.located_on_workspace (workspace)) + handle_window_removed (window); + } + void update_windows () { windows.remove_all_children ();