mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 06:41:36 +03:00
Fix occasional crashes in alt-tab-switch
This commit is contained in:
parent
edb669934a
commit
4d6bce848d
@ -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<Meta.WindowActor> minimizing = new Gee.HashSet<Meta.WindowActor> ();
|
||||
Gee.HashSet<Meta.WindowActor> maximizing = new Gee.HashSet<Meta.WindowActor> ();
|
||||
Gee.HashSet<Meta.WindowActor> unmaximizing = new Gee.HashSet<Meta.WindowActor> ();
|
||||
@ -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,6 +177,9 @@ namespace Gala
|
||||
|
||||
public new void end_modal ()
|
||||
{
|
||||
if (modal_count > 0)
|
||||
modal_count --;
|
||||
if (modal_count == 0)
|
||||
base.end_modal (get_screen ().get_display ().get_current_time ());
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ namespace Gala
|
||||
|
||||
Meta.Window? current_window;
|
||||
|
||||
bool active; //switcher is currently running
|
||||
|
||||
public WindowSwitcher (Gala.Plugin _plugin)
|
||||
{
|
||||
plugin = _plugin;
|
||||
@ -37,7 +39,14 @@ namespace Gala
|
||||
{
|
||||
if (((event.modifier_state & ModifierType.MOD1_MASK) == 0) ||
|
||||
event.keyval == Key.Alt_L) {
|
||||
close (event.time);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void close (uint time)
|
||||
{
|
||||
foreach (var clone in window_clones) {
|
||||
remove_child (clone);
|
||||
clone.destroy ();
|
||||
@ -54,11 +63,12 @@ namespace Gala
|
||||
window_clones.clear ();
|
||||
|
||||
plugin.end_modal ();
|
||||
current_window.activate (event.time);
|
||||
if (current_window != null) {
|
||||
current_window.activate (time);
|
||||
current_window = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
active = false;
|
||||
}
|
||||
|
||||
public override bool captured_event (Clutter.Event event)
|
||||
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user