[gtk/wip/otte/dnd: 69/70] events: Use GdkDrop as event sequence



commit 00df175cdc50e848ceae67f3e7832b726efa9ca4
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 ac46600a28..0e0a381431 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1486,13 +1486,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]