new_private->device = private->device ? g_object_ref (private->device) : NULL;
new_private->source_device = private->source_device ? g_object_ref (private->source_device) : NULL;
new_private->seat = private->seat;
+ new_private->tool = private->tool;
}
switch (event->any.type)
priv->seat = seat;
}
}
+
+/**
+ * gdk_event_get_device_tool:
+ * @event: a #GdkEvent
+ *
+ * If the event was generated by a device that supports
+ * different tools (eg. a tablet), this function will
+ * return a #GdkDeviceTool representing the tool that
+ * caused the event. Otherwise, %NULL will be returned.
+ *
+ * Note: the #GdkDeviceTool<!-- -->s will be constant during
+ * the application lifetime, if settings must be stored
+ * persistently across runs, see gdk_device_tool_get_serial()
+ *
+ * Returns: (transfer none): The current device tool, or %NULL
+ *
+ * Since: 3.22
+ **/
+GdkDeviceTool *
+gdk_event_get_device_tool (const GdkEvent *event)
+{
+ GdkEventPrivate *private;
+
+ if (!gdk_event_is_allocated (event))
+ return NULL;
+
+ private = (GdkEventPrivate *) event;
+ return private->tool;
+}
+
+/**
+ * gdk_event_set_device_tool:
+ * @event: a #GdkEvent
+ * @tool: (nullable): tool to set on the event, or %NULL
+ *
+ * Sets the device tool for this event, should be rarely used.
+ *
+ * Since: 3.22
+ **/
+void
+gdk_event_set_device_tool (GdkEvent *event,
+ GdkDeviceTool *tool)
+{
+ GdkEventPrivate *private;
+
+ if (!gdk_event_is_allocated (event))
+ return;
+
+ private = (GdkEventPrivate *) event;
+ private->tool = tool;
+}
gboolean gdk_setting_get (const gchar *name,
GValue *value);
+GDK_AVAILABLE_IN_3_16
+GdkDeviceTool *gdk_event_get_device_tool (const GdkEvent *event);
+
+GDK_AVAILABLE_IN_3_16
+void gdk_event_set_device_tool (GdkEvent *event,
+ GdkDeviceTool *tool);
+
G_END_DECLS
#endif /* __GDK_EVENTS_H__ */