@@ -120,6 +120,7 @@ namespace Gala {
120120 gesture_tracker = new GestureTracker (AnimationDuration . WORKSPACE_SWITCH_MIN , AnimationDuration . WORKSPACE_SWITCH );
121121 gesture_tracker. enable_touchpad ();
122122 gesture_tracker. on_gesture_detected. connect (on_gesture_detected);
123+ gesture_tracker. on_gesture_handled. connect (on_gesture_handled);
123124
124125 info = Meta . PluginInfo () {name = " Gala" , version = Config . VERSION , author = " Gala Developers" ,
125126 license = " GPLv3" , description = " A nice elementary window manager" };
@@ -553,57 +554,41 @@ namespace Gala {
553554 }
554555 }
555556
556- private void on_gesture_detected (Gesture gesture ) {
557+ private bool on_gesture_detected (Gesture gesture ) {
557558 if (workspace_view. is_opened ()) {
558- return ;
559- }
560-
561- if (gesture. type != Clutter . EventType . TOUCHPAD_SWIPE ||
562- (gesture. direction != GestureDirection . LEFT && gesture. direction != GestureDirection . RIGHT )) {
563- return ;
559+ return false ;
564560 }
565561
566- unowned var display = get_display ();
567-
568- var fingers = gesture. fingers;
569-
570- var three_finger_swipe_horizontal = GestureSettings . get_string (" three-finger-swipe-horizontal" );
571- var four_finger_swipe_horizontal = GestureSettings . get_string (" four-finger-swipe-horizontal" );
572-
573- var three_fingers_switch_to_workspace = fingers == 3 && three_finger_swipe_horizontal == " switch-to-workspace" ;
574- var four_fingers_switch_to_workspace = fingers == 4 && four_finger_swipe_horizontal == " switch-to-workspace" ;
575-
576- var three_fingers_move_to_workspace = fingers == 3 && three_finger_swipe_horizontal == " move-to-workspace" ;
577- var four_fingers_move_to_workspace = fingers == 4 && four_finger_swipe_horizontal == " move-to-workspace" ;
578-
579- var three_fingers_switch_windows = fingers == 3 && three_finger_swipe_horizontal == " switch-windows" ;
580- var four_fingers_switch_windows = fingers == 4 && four_finger_swipe_horizontal == " switch-windows" ;
562+ var action = GestureSettings . get_action (gesture);
563+ switch_workspace_with_gesture = action == SWITCH_WORKSPACE || action == MOVE_TO_WORKSPACE ;
564+ return switch_workspace_with_gesture || (action == SWITCH_WINDOWS && ! window_switcher. opened);
565+ }
581566
582- switch_workspace_with_gesture = three_fingers_switch_to_workspace || four_fingers_switch_to_workspace;
583- if (switch_workspace_with_gesture) {
584- var direction = gesture_tracker. settings. get_natural_scroll_direction (gesture);
585- switch_to_next_workspace (direction, display. get_current_time ());
586- return ;
587- }
567+ private void on_gesture_handled (Gesture gesture , uint32 timestamp ) {
568+ var direction = gesture_tracker. settings. get_natural_scroll_direction (gesture);
588569
589- switch_workspace_with_gesture = three_fingers_move_to_workspace || four_fingers_move_to_workspace;
590- if (switch_workspace_with_gesture) {
591- unowned var manager = display. get_workspace_manager ();
570+ switch (GestureSettings . get_action (gesture)) {
571+ case MOVE_TO_WORKSPACE :
572+ unowned var display = get_display ();
573+ unowned var manager = display. get_workspace_manager ();
592574
593- var direction = gesture_tracker. settings. get_natural_scroll_direction (gesture);
575+ moving = display. focus_window;
576+ if (moving != null ) {
577+ moving. change_workspace (manager. get_active_workspace (). get_neighbor (direction));
578+ }
579+ switch_to_next_workspace (direction, timestamp);
580+ break ;
594581
595- moving = display. focus_window;
596- if (moving != null ) {
597- moving. change_workspace (manager. get_active_workspace (). get_neighbor (direction));
598- }
582+ case SWITCH_WORKSPACE :
583+ switch_to_next_workspace (direction, timestamp);
584+ break ;
599585
600- switch_to_next_workspace (direction, display . get_current_time ());
601- return ;
602- }
586+ case SWITCH_WINDOWS :
587+ window_switcher . handle_gesture (gesture . direction) ;
588+ break ;
603589
604- var switch_windows = three_fingers_switch_windows || four_fingers_switch_windows;
605- if (switch_windows && ! window_switcher. opened) {
606- window_switcher. handle_gesture (gesture. direction);
590+ default:
591+ break ;
607592 }
608593 }
609594
0 commit comments