[gnome-2048] Restrict gesture a bit.



commit 0e075cdaeb3d71f9f56e90df231a7f9fc0571308
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Apr 16 19:00:49 2020 +0200

    Restrict gesture a bit.

 src/game-window.vala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index b0f402f..0103778 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -348,12 +348,16 @@ private class GameWindow : ApplicationWindow
     {
         gesture_swipe = new GestureSwipe (_embed);  // _window works, but problems with headerbar; the main 
grid or the aspectframe do as _embed
         gesture_swipe.set_propagation_phase (PropagationPhase.CAPTURE);
-        gesture_swipe.set_button (/* all events */ 0);
+        gesture_swipe.set_button (/* all buttons */ 0);
         gesture_swipe.swipe.connect (_on_swipe);
     }
 
     private inline void _on_swipe (GestureSwipe _gesture_swipe, double velocity_x, double velocity_y)   // 
do not make static, _gesture_swipe.get_wigdet () is _embed, not the window
     {
+        uint button = _gesture_swipe.get_current_button ();
+        if (button != Gdk.BUTTON_PRIMARY && button != Gdk.BUTTON_SECONDARY)
+            return;
+
         if (_game.cannot_move ())
             return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]