diff --git a/src/Main.vala b/src/Main.vala index ce32f543..b67b9a7c 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -27,6 +27,8 @@ namespace Gala Window? moving; //place for the window that is being moved over + int modal_count; //count of modal modes overlaying each other + Gee.HashSet minimizing = new Gee.HashSet (); Gee.HashSet maximizing = new Gee.HashSet (); Gee.HashSet unmaximizing = new Gee.HashSet (); @@ -162,6 +164,11 @@ namespace Gala public new void begin_modal () { + if (modal_count != 0) { + return; + } + modal_count ++; + var screen = get_screen (); var display = screen.get_display (); @@ -170,7 +177,10 @@ namespace Gala public new void end_modal () { - base.end_modal (get_screen ().get_display ().get_current_time ()); + if (modal_count > 0) + modal_count --; + if (modal_count == 0) + base.end_modal (get_screen ().get_display ().get_current_time ()); } public void get_current_cursor_position (out int x, out int y) diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala index 4cbd9d72..5dc4ac66 100644 --- a/src/Widgets/WindowSwitcher.vala +++ b/src/Widgets/WindowSwitcher.vala @@ -28,6 +28,8 @@ namespace Gala Meta.Window? current_window; + bool active; //switcher is currently running + public WindowSwitcher (Gala.Plugin _plugin) { plugin = _plugin; @@ -37,30 +39,38 @@ namespace Gala { if (((event.modifier_state & ModifierType.MOD1_MASK) == 0) || event.keyval == Key.Alt_L) { - - foreach (var clone in window_clones) { - remove_child (clone); - clone.destroy (); - } - - Meta.Compositor.get_window_actors (plugin.get_screen ()).foreach ((w) => { - var meta_win = w.get_meta_window (); - if (!meta_win.minimized && - (meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) || - meta_win.is_on_all_workspaces ()) - w.show (); - }); - - window_clones.clear (); - - plugin.end_modal (); - current_window.activate (event.time); - current_window = null; + close (event.time); } return true; } + void close (uint time) + { + foreach (var clone in window_clones) { + remove_child (clone); + clone.destroy (); + } + + Meta.Compositor.get_window_actors (plugin.get_screen ()).foreach ((w) => { + var meta_win = w.get_meta_window (); + if (!meta_win.minimized && + (meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) || + meta_win.is_on_all_workspaces ()) + w.show (); + }); + + window_clones.clear (); + + plugin.end_modal (); + if (current_window != null) { + current_window.activate (time); + current_window = null; + } + + active = false; + } + public override bool captured_event (Clutter.Event event) { if (!(event.get_type () == EventType.KEY_PRESS)) @@ -113,6 +123,14 @@ namespace Gala public void handle_switch_windows (Meta.Display display, Meta.Screen screen, Meta.Window? window, X.Event event, Meta.KeyBinding binding) { + if (active) { + if (window_clones.size != 0) + close (screen.get_display ().get_current_time ()); + return; + } + + active = true; + var metawindows = display.get_tab_list (Meta.TabList.NORMAL, screen, screen.get_active_workspace ()); if (metawindows.length () <= 1) return; diff --git a/src/Widgets/WorkspaceView.vala b/src/Widgets/WorkspaceView.vala index 732c1b00..c6713658 100644 --- a/src/Widgets/WorkspaceView.vala +++ b/src/Widgets/WorkspaceView.vala @@ -100,6 +100,8 @@ namespace Gala screen.remove_workspace (screen.get_workspaces ().nth_data (i), screen.get_display ().get_current_time ()); } } + + add_workspace (); } bool draw_background (Cairo.Context cr)