[gtk+] wayland: Add defines to convert between event sequences and touch slots



commit ba83a2757e0372f387beecd3e4989057233f11c7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 22 13:33:14 2014 +0200

    wayland: Add defines to convert between event sequences and touch slots
    
    This makes it clearer in code what's going on there.
    GDK_SLOT_TO_EVENT_SEQUENCE isn't used yet, but will be useful in the
    future.

 gdk/wayland/gdkdevice-wayland.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 26d81b4..a6529d9 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -120,6 +120,9 @@ G_DEFINE_TYPE (GdkWaylandDevice, gdk_wayland_device, GDK_TYPE_DEVICE)
 #define GDK_IS_WAYLAND_DEVICE_MANAGER_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER))
 #define GDK_WAYLAND_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER, GdkWaylandDeviceManagerClass))
 
+#define GDK_SLOT_TO_EVENT_SEQUENCE(s) ((GdkEventSequence *) GUINT_TO_POINTER((s) + 1))
+#define GDK_EVENT_SEQUENCE_TO_SLOT(s) (GPOINTER_TO_UINT(s) - 1)
+
 typedef struct _GdkWaylandDeviceManager GdkWaylandDeviceManager;
 typedef struct _GdkWaylandDeviceManagerClass GdkWaylandDeviceManagerClass;
 
@@ -1349,7 +1352,7 @@ _create_touch_event (GdkWaylandDeviceData *device,
   event->touch.time = time;
   event->touch.state = device->modifiers;
   gdk_event_set_screen (event, display->screen);
-  event->touch.sequence = GUINT_TO_POINTER (touch->id + 1);
+  event->touch.sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
 
   if (touch->initial_touch)
     {


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