[five-or-more/arnaudb/wip/gtk4: 58/80] Update to GestureClick.




commit 5a19ea0f250e6a037a91bbafb2e8916964f03345
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Mar 12 21:27:01 2020 +0100

    Update to GestureClick.
    
    And other EventController things.

 src/view.vala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/view.vala b/src/view.vala
index 21ce61a..379a727 100644
--- a/src/view.vala
+++ b/src/view.vala
@@ -51,7 +51,7 @@ private class View : DrawingArea
     private uint animation_id;
 
     private EventControllerKey key_controller;          // for keeping in memory
-    private GestureMultiPress click_controller;         // for keeping in memory
+    private GestureClick click_controller;              // for keeping in memory
 
     internal const string default_background_color = "rgb(117,144,174)";
     private string _background_color = default_background_color;
@@ -168,8 +168,9 @@ private class View : DrawingArea
 
     private void init_keyboard ()
     {
-        key_controller = new Gtk.EventControllerKey (this);
+        key_controller = new Gtk.EventControllerKey ();
         key_controller.key_pressed.connect (on_key_pressed);
+        add_controller (key_controller);
     }
 
     private inline bool on_key_pressed (Gtk.EventControllerKey _key_controller, uint keyval, uint keycode, 
Gdk.ModifierType state)
@@ -293,11 +294,12 @@ private class View : DrawingArea
 
     private void init_mouse ()
     {
-        click_controller = new GestureMultiPress (this);    // only reacts to Gdk.BUTTON_PRIMARY
+        click_controller = new GestureClick ();         // only reacts to Gdk.BUTTON_PRIMARY
         click_controller.pressed.connect (on_click);
+        add_controller (click_controller);
     }
 
-    private inline void on_click (GestureMultiPress _click_controller, int n_press, double event_x, double 
event_y)
+    private inline void on_click (GestureClick _click_controller, int n_press, double event_x, double 
event_y)
     {
         if (game == null || game.animating)
             return;


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