limit rate at which toggling can be spammed

This commit is contained in:
Tom Beckmann 2014-07-17 03:00:57 +02:00
parent fedd31b2d6
commit 447f0d450e

View File

@ -33,7 +33,8 @@ namespace Gala
public WindowManager wm { get; construct; } public WindowManager wm { get; construct; }
Meta.Screen screen; Meta.Screen screen;
bool opened; bool opened = false;
bool animating = false;
bool is_smooth_scrolling = false; bool is_smooth_scrolling = false;
@ -397,8 +398,12 @@ namespace Gala
*/ */
public void toggle () public void toggle ()
{ {
opened = !opened; if (animating)
return;
animating = true;
opened = !opened;
var opening = opened; var opening = opened;
foreach (var container in window_containers_monitors) { foreach (var container in window_containers_monitors) {
@ -462,6 +467,13 @@ namespace Gala
wm.block_keybindings_in_modal = true; wm.block_keybindings_in_modal = true;
wm.end_modal (); wm.end_modal ();
animating = false;
return false;
});
} else {
Timeout.add (200, () => {
animating = false;
return false; return false;
}); });
} }