[gnome-2048/arnaudb/wip/gtk4: 18/57] Adapt event controllers.




commit 21ba96934447bb9e191284c121efdb622b5a546d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Apr 28 07:50:51 2020 +0200

    Adapt event controllers.

 src/game-window.vala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index af914b4..51b782c 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -304,8 +304,9 @@ private class GameWindow : ApplicationWindow
 
     private inline void _init_keyboard ()   // called on construct
     {
-        key_controller = new EventControllerKey (this);
+        key_controller = new EventControllerKey ();
         key_controller.key_pressed.connect (on_key_pressed);
+        ((Widget) this).add_controller (key_controller);
     }
 
     private static inline bool on_key_pressed (EventControllerKey _key_controller, uint keyval, uint 
keycode, Gdk.ModifierType state)
@@ -346,10 +347,11 @@ private class GameWindow : ApplicationWindow
 
     private inline void _init_gestures ()
     {
-        gesture_swipe = new GestureSwipe (_board);  // _window works, but problems with headerbar; the main 
grid or the aspectframe do as _board
+        gesture_swipe = new GestureSwipe ();  // _window works, but problems with headerbar; the main grid 
or the aspectframe do as _board
         gesture_swipe.set_propagation_phase (PropagationPhase.CAPTURE);
         gesture_swipe.set_button (/* all buttons */ 0);
         gesture_swipe.swipe.connect (_on_swipe);
+        _board.add_controller (gesture_swipe);
     }
 
     private inline void _on_swipe (GestureSwipe _gesture_swipe, double velocity_x, double velocity_y)   // 
do not make static, _gesture_swipe.get_wigdet () is _board, not the window


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