[gnome-2048/arnaudb/wip/gtk4: 10/36] Adapt event controllers.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 10/36] Adapt event controllers.
- Date: Tue, 14 Jul 2020 10:59:13 +0000 (UTC)
commit 3d68c94c48f7a82ab67135b7c87b1dcbefdcaadb
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 47f23ae..4cd2f82 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]