[clutter/wip/evdev-tablet-support: 84/88] event: Add ClutterInputDeviceTool information to clutter events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/evdev-tablet-support: 84/88] event: Add ClutterInputDeviceTool information to clutter events
- Date: Tue, 31 Mar 2015 11:23:44 +0000 (UTC)
commit 72001fa537b328ed340b983cdb416c3bc8e8aa25
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-event.c | 48 ++++++++++++++++++++++++++++
clutter/clutter-event.h | 7 ++++
doc/reference/clutter/clutter-sections.txt | 2 +
3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c
index 26d5611..5228ee1 100644
--- a/clutter/clutter-event.c
+++ b/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;
@@ -1177,6 +1179,52 @@ 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.22
+ **/
+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: The tool of this event
+ **/
+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.
*
diff --git a/clutter/clutter-event.h b/clutter/clutter-event.h
index 9e39693..5ceec75 100644
--- a/clutter/clutter-event.h
+++ b/clutter/clutter-event.h
@@ -489,6 +489,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_1_22
+void clutter_event_set_device_tool (ClutterEvent *event,
+ ClutterInputDeviceTool *tool);
+CLUTTER_AVAILABLE_IN_1_22
+ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
+
CLUTTER_AVAILABLE_IN_1_8
void clutter_event_set_source (ClutterEvent *event,
ClutterActor *actor);
diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt
index 7d6b8a6..5a4b4bb 100644
--- a/doc/reference/clutter/clutter-sections.txt
+++ b/doc/reference/clutter/clutter-sections.txt
@@ -1126,6 +1126,8 @@ clutter_event_get_position
clutter_event_has_control_modifier
clutter_event_has_shift_modifier
clutter_event_is_pointer_emulated
+clutter_event_set_device_tool
+clutter_event_get_device_tool
<SUBSECTION>
clutter_event_get
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]