[gtk/matthiasc/for-master: 77/77] events: Make proximity and scroll events have tools



commit e5d83eea301cc253f712d5e7731a451ddd616666
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 14 16:46:43 2020 -0500

    events: Make proximity and scroll events have tools
    
    The Wayland backend tries to set device tools on these
    events, and it was just an oversight that they don't
    carry them.

 gdk/gdkevents.c        | 19 +++++++++++++++++++
 gdk/gdkeventsprivate.h |  2 ++
 2 files changed, 21 insertions(+)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 4db6aea8cc..b403f5da2b 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -707,6 +707,15 @@ gdk_event_finalize (GObject *object)
       g_list_free_full (event->motion.history, g_free);
       break;
 
+    case GDK_PROXIMITY_IN:
+    case GDK_PROXIMITY_OUT:
+      g_clear_object (&event->proximity.tool);
+      break;
+
+    case GDK_SCROLL:
+      g_clear_object (&event->scroll.tool);
+      break;
+
     default:
       break;
     }
@@ -1834,6 +1843,11 @@ gdk_event_get_device_tool (const GdkEvent *event)
     return event->button.tool;
   else if (event->any.type == GDK_MOTION_NOTIFY)
     return event->motion.tool;
+  else if (event->any.type == GDK_PROXIMITY_IN ||
+           event->any.type == GDK_PROXIMITY_OUT)
+    return event->proximity.tool;
+  else if (event->any.type == GDK_SCROLL)
+    return event->scroll.tool;
 
   return NULL;
 }
@@ -1854,6 +1868,11 @@ gdk_event_set_device_tool (GdkEvent      *event,
     g_set_object (&event->button.tool, tool);
   else if (event->any.type == GDK_MOTION_NOTIFY)
     g_set_object (&event->motion.tool, tool);
+  else if (event->any.type == GDK_PROXIMITY_IN ||
+           event->any.type == GDK_PROXIMITY_OUT)
+    g_set_object (&event->proximity.tool, tool);
+  else if (event->any.type == GDK_SCROLL)
+    g_set_object (&event->scroll.tool, tool);
 }
 
 void
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index fe9b80a7f8..191fcb2f4d 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -231,6 +231,7 @@ struct _GdkEventScroll
   gdouble delta_x;
   gdouble delta_y;
   guint is_stop : 1;
+  GdkDeviceTool *tool;
 };
 
 /*
@@ -370,6 +371,7 @@ struct _GdkEventProximity
 {
   GdkEventAny any;
   guint32 time;
+  GdkDeviceTool *tool;
 };
 
 /*


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