[mutter] event: Add ClutterInputDeviceTool information to clutter events



commit 3602b49a30a31d274edba45d3eca8908716ff2c8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Feb 4 16:59:22 2015 +0100

    event: Add ClutterInputDeviceTool information to clutter events
    
    These can be used to determine the tool that's being in use for a given event

 clutter/clutter/clutter-event.c |   51 +++++++++++++++++++++++++++++++++++++++
 clutter/clutter/clutter-event.h |    7 +++++
 2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 2d331f8..28bc4b9 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -54,6 +54,8 @@ typedef struct _ClutterEventPrivate {
   gdouble delta_x;
   gdouble delta_y;
 
+  ClutterInputDeviceTool *tool;
+
   gpointer platform_data;
 
   ClutterModifierType button_state;
@@ -1207,6 +1209,54 @@ clutter_event_get_device (const ClutterEvent *event)
 }
 
 /**
+ * clutter_event_set_device_tool:
+ * @event: a #ClutterEvent
+ * @tool: (nullable): a #ClutterInputDeviceTool
+ *
+ * Sets the tool in use for this event
+ *
+ * Since: 1.28
+ **/
+void
+clutter_event_set_device_tool (ClutterEvent           *event,
+                               ClutterInputDeviceTool *tool)
+{
+  g_return_if_fail (event != NULL);
+
+  if (is_event_allocated (event))
+    {
+      ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
+
+      real_event->tool = tool;
+    }
+}
+
+/**
+ * clutter_event_get_device_tool:
+ * @event: a #ClutterEvent
+ *
+ * Returns the device tool that originated this event
+ *
+ * Returns: (transfer none): The tool of this event
+ *
+ * Since: 1.28
+ **/
+ClutterInputDeviceTool *
+clutter_event_get_device_tool (const ClutterEvent *event)
+{
+  g_return_val_if_fail (event != NULL, NULL);
+
+  if (is_event_allocated (event))
+    {
+      ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
+
+      return real_event->tool;
+    }
+
+  return NULL;
+}
+
+/**
  * clutter_event_new:
  * @type: The type of event.
  *
@@ -1269,6 +1319,7 @@ clutter_event_copy (const ClutterEvent *event)
       new_real_event->button_state = real_event->button_state;
       new_real_event->latched_state = real_event->latched_state;
       new_real_event->locked_state = real_event->locked_state;
+      new_real_event->tool = real_event->tool;
     }
 
   device = clutter_event_get_device (event);
diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h
index b04d322..fd9afe2 100644
--- a/clutter/clutter/clutter-event.h
+++ b/clutter/clutter/clutter-event.h
@@ -575,6 +575,13 @@ void                    clutter_event_set_source_device         (ClutterEvent
 
 CLUTTER_AVAILABLE_IN_1_6
 ClutterInputDevice *    clutter_event_get_source_device         (const ClutterEvent     *event);
+
+CLUTTER_AVAILABLE_IN_ALL
+void                    clutter_event_set_device_tool           (ClutterEvent           *event,
+                                                                 ClutterInputDeviceTool *tool);
+CLUTTER_AVAILABLE_IN_ALL
+ClutterInputDeviceTool *clutter_event_get_device_tool           (const ClutterEvent     *event);
+
 CLUTTER_AVAILABLE_IN_1_8
 void                    clutter_event_set_source                (ClutterEvent           *event,
                                                                  ClutterActor           *actor);


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