Fix workspaces nudging all the time

This commit is contained in:
Tom Beckmann 2012-09-01 17:42:49 +02:00
parent f93a5dec32
commit 257e45de07

View File

@ -204,12 +204,16 @@ namespace Gala
void switch_to_next_workspace (MotionDirection direction)
{
var display = screen.get_display ();
var old_index = screen.get_active_workspace_index ();
var neighbor = screen.get_active_workspace ().get_neighbor (direction);
neighbor.activate (display.get_current_time ());
//if we didnt switch, show a nudge-over animation
if (screen.get_active_workspace () == neighbor) {
// if we didnt switch, show a nudge-over animation. need to take the indices
// here since the changing only applies after the animation ends
if (old_index == 0 && direction == MotionDirection.LEFT ||
old_index == screen.n_workspaces - 1 && direction == MotionDirection.RIGHT) {
var dest = direction == MotionDirection.LEFT ? 32.0f : -32.0f;
Compositor.get_window_group_for_screen (screen).animate (Clutter.AnimationMode.LINEAR, 100, x:dest);
Clutter.Threads.Timeout.add (210, () => {