[gnome-klotski/arnaudb/wip/gtk4: 3/13] Update to GestureClick.



commit ae00a4a6be965535f47a8a013308547fd5598c6d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Mar 5 18:46:00 2020 +0100

    Update to GestureClick.
    
    And other EventController things.

 src/puzzle-view.vala | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/puzzle-view.vala b/src/puzzle-view.vala
index 2be4477..7dc0d7f 100644
--- a/src/puzzle-view.vala
+++ b/src/puzzle-view.vala
@@ -230,19 +230,21 @@ private class PuzzleView : Gtk.DrawingArea
     \*/
 
     private Gtk.EventControllerMotion motion_controller;    // for keeping in memory
-    private Gtk.GestureMultiPress click_controller;         // for keeping in memory
+    private Gtk.GestureClick click_controller;              // for keeping in memory
 
     private void init_mouse ()  // called on construct
     {
-        motion_controller = new Gtk.EventControllerMotion (this);
+        motion_controller = new Gtk.EventControllerMotion ();
         motion_controller.motion.connect (on_motion);
+        add_controller (motion_controller);
 
-        click_controller = new Gtk.GestureMultiPress (this);
+        click_controller = new Gtk.GestureClick ();
         click_controller.pressed.connect (on_click);
         click_controller.released.connect (on_release);
+        add_controller (click_controller);
     }
 
-    private static inline void on_click (Gtk.GestureMultiPress _click_controller, int n_press, double 
event_x, double event_y)
+    private static inline void on_click (Gtk.GestureClick _click_controller, int n_press, double event_x, 
double event_y)
     {
         uint button = _click_controller.get_button ();
         if (button == Gdk.BUTTON_PRIMARY)
@@ -282,7 +284,7 @@ private class PuzzleView : Gtk.DrawingArea
         }
     }
 
-    private static inline void on_release (Gtk.GestureMultiPress _click_controller, int n_press, double 
event_x, double event_y)
+    private static inline void on_release (Gtk.GestureClick _click_controller, int n_press, double event_x, 
double event_y)
     {
         PuzzleView _this = (PuzzleView) _click_controller.get_widget ();
         uint button = _click_controller.get_button ();


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