Add watches for window_left_monitors to the places where we use window clones

This commit is contained in:
Tom Beckmann 2013-05-03 18:53:49 +02:00
parent 1487a78b27
commit b06b3137ac
4 changed files with 37 additions and 4 deletions

View File

@ -60,7 +60,7 @@ namespace Gala
Gee.HashSet<Meta.WindowActor> unmaximizing = new Gee.HashSet<Meta.WindowActor> ();
Gee.HashSet<Meta.WindowActor> mapping = new Gee.HashSet<Meta.WindowActor> ();
Gee.HashSet<Meta.WindowActor> destroying = new Gee.HashSet<Meta.WindowActor> ();
public Plugin ()
{
info = PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",

View File

@ -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;

View File

@ -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;

View File

@ -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 ();