@@ -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,10 +72,12 @@ 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 (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
7578 workspace_gesture_tracker = new GestureTracker (AnimationDuration . WORKSPACE_SWITCH_MIN , AnimationDuration . WORKSPACE_SWITCH );
7679 workspace_gesture_tracker. enable_touchpad ();
80+ workspace_gesture_tracker. enable_pan (this , () = > workspaces_travel_distance);
7781 workspace_gesture_tracker. enable_scroll (this , Clutter . Orientation . HORIZONTAL );
7882 workspace_gesture_tracker. on_gesture_detected. connect (on_workspace_gesture_detected);
7983
@@ -90,16 +94,17 @@ namespace Gala {
9094 blurred_bg. add_effect (new BlurEffect (blurred_bg, 18 ));
9195 blurred_bg. add_effect (brightness_effect);
9296
93- add_child (blurred_bg);
94-
9597 // Create a child container that will be sized to fit the primary monitor, to contain the "main"
9698 // multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
9799 // stage as it contains MonitorClones for each monitor.
98- primary_monitor_container = new Clutter .Actor ();
100+ primary_monitor_container = new Clutter .Actor () {
101+ reactive = true
102+ };
103+ primary_monitor_container. add_child (blurred_bg);
99104 primary_monitor_container. add_child (icon_groups);
100105 primary_monitor_container. add_child (workspaces);
106+ primary_monitor_container. add_child (dock_clones);
101107 add_child (primary_monitor_container);
102- add_child (dock_clones);
103108
104109 unowned var manager = display. get_workspace_manager ();
105110 manager. workspace_added. connect (add_workspace);
@@ -310,6 +315,7 @@ namespace Gala {
310315 }
311316
312317 private bool on_workspace_gesture_detected (Gesture gesture) {
318+ warning (" DETECTED" );
313319 if (! opened) {
314320 return false ;
315321 }
@@ -323,6 +329,7 @@ namespace Gala {
323329 if (gesture. type == Clutter . EventType . SCROLL || (can_handle_swipe && fingers)) {
324330 var direction = workspace_gesture_tracker. settings. get_natural_scroll_direction (gesture);
325331 switch_workspace_with_gesture (direction);
332+ warning (" GO" );
326333 return true ;
327334 }
328335
@@ -370,6 +377,8 @@ namespace Gala {
370377 }
371378 }
372379
380+ workspaces_travel_distance = (initial_x - target_x). abs ();
381+
373382 if (! is_nudge_animation && active_icon_group. get_transition (" backdrop-opacity" ) != null ) {
374383 active_icon_group. remove_transition (" backdrop-opacity" );
375384 }
@@ -699,9 +708,6 @@ namespace Gala {
699708 }
700709
701710 if (opening) {
702- modal_proxy = wm. push_modal (this );
703- modal_proxy. set_keybinding_filter (keybinding_filter);
704-
705711 wm. background_group. hide ();
706712 wm. window_group. hide ();
707713 wm. top_window_group. hide ();
@@ -771,6 +777,12 @@ namespace Gala {
771777 dock_clones. destroy_all_children ();
772778
773779 wm. pop_modal (modal_proxy);
780+
781+ multitasking_gesture_tracker. enable_pan (wm. get_display (). get_stage (), () = > InternalUtils . travel_distance_from_primary (wm. get_display (), VERTICAL ));
782+ } else {
783+ modal_proxy = wm. push_modal (this );
784+ modal_proxy. set_keybinding_filter (keybinding_filter);
785+ multitasking_gesture_tracker. enable_pan (primary_monitor_container, () = > InternalUtils . travel_distance_from_primary (wm. get_display (), VERTICAL ));
774786 }
775787
776788 animating = false ;
0 commit comments