[gtk/crossing-details] motion controller: add details to signals



commit f4e3562a62711dacd32748418893066a6a73120f
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Mar 6 14:56:46 2019 -0500

    motion controller: add details to signals
    
    The ::enter and ::leave signals get emitted up and down the
    connecting path between the old an the new pointer location.
    
    The signals are less useful if you can't find out where along
    the path you are. That is what crossing mode and detail are
    about, so add those to the signals.

 gtk/gtkeventcontrollermotion.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkeventcontrollermotion.c b/gtk/gtkeventcontrollermotion.c
index f1d0d33a77..5f40e94ade 100644
--- a/gtk/gtkeventcontrollermotion.c
+++ b/gtk/gtkeventcontrollermotion.c
@@ -67,16 +67,27 @@ gtk_event_controller_motion_handle_event (GtkEventController *controller,
   if (type == GDK_ENTER_NOTIFY)
     {
       double x, y;
+      GdkCrossingMode mode;
+      GdkNotifyType detail;
+
       gdk_event_get_coords (event, &x, &y);
-      g_signal_emit (controller, signals[ENTER], 0, x, y);
+      gdk_event_get_crossing_mode (event, &mode);
+      gdk_event_get_crossing_detail (event, &detail);
+      g_signal_emit (controller, signals[ENTER], 0, x, y, mode, detail);
     }
   else if (type == GDK_LEAVE_NOTIFY)
     {
-      g_signal_emit (controller, signals[LEAVE], 0);
+      GdkCrossingMode mode;
+      GdkNotifyType detail;
+
+      gdk_event_get_crossing_mode (event, &mode);
+      gdk_event_get_crossing_detail (event, &detail);
+      g_signal_emit (controller, signals[LEAVE], 0, mode, detail);
     }
   else if (type == GDK_MOTION_NOTIFY)
     {
       double x, y;
+
       gdk_event_get_coords (event, &x, &y);
       g_signal_emit (controller, signals[MOTION], 0, x, y);
     }
@@ -107,7 +118,12 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
                   G_SIGNAL_RUN_FIRST,
                   0, NULL, NULL,
                   NULL,
-                  G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+                  G_TYPE_NONE,
+                  4,
+                  G_TYPE_DOUBLE,
+                  G_TYPE_DOUBLE,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 
   /**
    * GtkEventControllerMotion::leave:
@@ -121,7 +137,10 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
                   G_SIGNAL_RUN_FIRST,
                   0, NULL, NULL,
                  NULL,
-                  G_TYPE_NONE, 0);
+                  G_TYPE_NONE,
+                  2,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 
   /**
    * GtkEventControllerMotion::motion:


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