mirror of
https://github.com/elementary/gala.git
synced 2025-01-01 14:06:42 +03:00
Fix workspaces nudging all the time
This commit is contained in:
parent
f93a5dec32
commit
257e45de07
@ -204,12 +204,16 @@ namespace Gala
|
|||||||
void switch_to_next_workspace (MotionDirection direction)
|
void switch_to_next_workspace (MotionDirection direction)
|
||||||
{
|
{
|
||||||
var display = screen.get_display ();
|
var display = screen.get_display ();
|
||||||
|
var old_index = screen.get_active_workspace_index ();
|
||||||
var neighbor = screen.get_active_workspace ().get_neighbor (direction);
|
var neighbor = screen.get_active_workspace ().get_neighbor (direction);
|
||||||
|
|
||||||
neighbor.activate (display.get_current_time ());
|
neighbor.activate (display.get_current_time ());
|
||||||
|
|
||||||
//if we didnt switch, show a nudge-over animation
|
// if we didnt switch, show a nudge-over animation. need to take the indices
|
||||||
if (screen.get_active_workspace () == neighbor) {
|
// 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;
|
var dest = direction == MotionDirection.LEFT ? 32.0f : -32.0f;
|
||||||
Compositor.get_window_group_for_screen (screen).animate (Clutter.AnimationMode.LINEAR, 100, x:dest);
|
Compositor.get_window_group_for_screen (screen).animate (Clutter.AnimationMode.LINEAR, 100, x:dest);
|
||||||
Clutter.Threads.Timeout.add (210, () => {
|
Clutter.Threads.Timeout.add (210, () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user