@@ -53,6 +53,8 @@ namespace Gala {
5353 }
5454 }
5555
56+ private float workspaces_travel_distance;
57+
5658 public MultitaskingView (WindowManager wm ) {
5759 Object (wm: wm);
5860 }
@@ -70,11 +72,13 @@ namespace Gala {
7072
7173 multitasking_gesture_tracker = new GestureTracker (ANIMATION_DURATION , ANIMATION_DURATION );
7274 multitasking_gesture_tracker. enable_touchpad ();
75+ multitasking_gesture_tracker. enable_pan (wm, display. get_stage (), () = > InternalUtils . travel_distance_from_primary (wm. get_display (), VERTICAL ));
7376 multitasking_gesture_tracker. on_gesture_detected. connect (on_multitasking_gesture_detected);
7477 multitasking_gesture_tracker. on_gesture_handled. connect (() = > toggle (true , false ));
7578
7679 workspace_gesture_tracker = new GestureTracker (AnimationDuration . WORKSPACE_SWITCH_MIN , AnimationDuration . WORKSPACE_SWITCH );
7780 workspace_gesture_tracker. enable_touchpad ();
81+ workspace_gesture_tracker. enable_pan (wm, this , () = > workspaces_travel_distance);
7882 workspace_gesture_tracker. enable_scroll (this , Clutter . Orientation . HORIZONTAL );
7983 workspace_gesture_tracker. on_gesture_detected. connect (on_workspace_gesture_detected);
8084 workspace_gesture_tracker. on_gesture_handled. connect ((gesture, timestamp) = > {
@@ -312,7 +316,8 @@ namespace Gala {
312316 return false ;
313317 }
314318
315- if (gesture. type == SCROLL || GestureSettings . get_action (gesture) == SWITCH_WORKSPACE ) {
319+ if (gesture. type == SCROLL || GestureSettings . get_action (gesture) == SWITCH_WORKSPACE ||
320+ gesture. type == TOUCHPAD_SWIPE && gesture. fingers == 1 && (gesture. direction == RIGHT || gesture. direction == LEFT )) {
316321 return true ;
317322 }
318323
@@ -360,6 +365,8 @@ namespace Gala {
360365 }
361366 }
362367
368+ workspaces_travel_distance = (initial_x - target_x). abs ();
369+
363370 if (! is_nudge_animation && active_icon_group. get_transition (" backdrop-opacity" ) != null ) {
364371 active_icon_group. remove_transition (" backdrop-opacity" );
365372 }
@@ -689,9 +696,6 @@ namespace Gala {
689696 }
690697
691698 if (opening) {
692- modal_proxy = wm. push_modal (this );
693- modal_proxy. set_keybinding_filter (keybinding_filter);
694-
695699 wm. background_group. hide ();
696700 wm. window_group. hide ();
697701 wm. top_window_group. hide ();
@@ -761,6 +765,13 @@ namespace Gala {
761765 dock_clones. destroy_all_children ();
762766
763767 wm. pop_modal (modal_proxy);
768+
769+ multitasking_gesture_tracker. enable_pan (wm, wm. get_display (). get_stage (), () = > InternalUtils . travel_distance_from_primary (wm. get_display (), VERTICAL ));
770+ } else {
771+ modal_proxy = wm. push_modal (this );
772+ modal_proxy. set_keybinding_filter (keybinding_filter);
773+ // We now have to listen to events on this because it's now modal i.e. the stage doesn't get the events anymore
774+ multitasking_gesture_tracker. enable_pan (wm, this , () = > InternalUtils . travel_distance_from_primary (wm. get_display (), VERTICAL ));
764775 }
765776
766777 animating = false ;
0 commit comments