[gtk/wip/otte/dnd: 2/9] events: Use GdkDrop as event sequence



commit e2e98870971461b62023349cbe16def6f9bba36a
Author: Benjamin Otte <otte redhat com>
Date:   Wed Feb 19 04:43:03 2020 +0100

    events: Use GdkDrop as event sequence
    
    This allows treating drop events like touch events, which GTK groups by
    event sequence.
    
    It's a bit ugly that we just case the GdkDrop pointer, but event
    sequences are only meant to be unique pointer ids, so it's fine.

 gdk/gdkevents.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index e66bbd4fd6..b316921c3a 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1480,13 +1480,23 @@ gdk_event_get_display (GdkEvent *event)
 GdkEventSequence *
 gdk_event_get_event_sequence (GdkEvent *event)
 {
-  if (event->any.type == GDK_TOUCH_BEGIN ||
-      event->any.type == GDK_TOUCH_UPDATE ||
-      event->any.type == GDK_TOUCH_END ||
-      event->any.type == GDK_TOUCH_CANCEL)
-    return event->touch.sequence;
+  switch ((int) event->any.type)
+    {
+    case GDK_TOUCH_BEGIN:
+    case GDK_TOUCH_UPDATE:
+    case GDK_TOUCH_END:
+    case GDK_TOUCH_CANCEL:
+      return event->touch.sequence;
 
-  return NULL;
+    case GDK_DRAG_ENTER:
+    case GDK_DRAG_LEAVE:
+    case GDK_DRAG_MOTION:
+    case GDK_DROP_START:
+      return (GdkEventSequence *) event->dnd.drop;
+
+    default:
+      return NULL;
+    }
 }
 
 /**


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