[gtk+/wip/wayland-tablet: 611/632] gdk: Add GdkSeat::tool-added/removed signals
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/wayland-tablet: 611/632] gdk: Add GdkSeat::tool-added/removed signals
- Date: Tue, 1 Mar 2016 11:46:21 +0000 (UTC)
commit 411e3b8b1114023a3c07db42472d9c389fb5b8e3
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 29 13:06:02 2016 +0100
gdk: Add GdkSeat::tool-added/removed signals
And a helper function to lookup a tool from the seat. Those are
tracker per-seat, and may be shared across devices.
gdk/gdkseat.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
gdk/gdkseatprivate.h | 12 ++++++++
2 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkseat.c b/gdk/gdkseat.c
index 0993042..55d3267 100644
--- a/gdk/gdkseat.c
+++ b/gdk/gdkseat.c
@@ -46,6 +46,8 @@ struct _GdkSeatPrivate
enum {
DEVICE_ADDED,
DEVICE_REMOVED,
+ TOOL_ADDED,
+ TOOL_REMOVED,
N_SIGNALS
};
@@ -147,6 +149,48 @@ gdk_seat_class_init (GdkSeatClass *klass)
GDK_TYPE_DEVICE);
/**
+ * GdkSeat::tool-added:
+ * @seat: the object on which the signal is emitted
+ * @tool: the new #GdkDeviceTool known to the seat
+ *
+ * The ::tool-added signal is emitted whenever a new tool
+ * is made known to the seat. The tool may later be assigned
+ * to a device (i.e. on proximity with a tablet). The device
+ * will emit the #GdkDevice::tool-changed signal accordingly.
+ *
+ * A same tool may be used by several devices.
+ *
+ * Since: 3.20
+ */
+ signals [TOOL_ADDED] =
+ g_signal_new (g_intern_static_string ("tool-added"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_DEVICE_TOOL);
+
+ /**
+ * GdkSeat::tool-removed:
+ * @seat: the object on which the signal is emitted
+ * @tool: the just removed #GdkDeviceTool
+ *
+ * This signal is emitted whenever a tool is no longer known
+ * to this @seat.
+ *
+ * Since: 3.20
+ */
+ signals [TOOL_REMOVED] =
+ g_signal_new (g_intern_static_string ("tool-removed"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_DEVICE_TOOL);
+
+ /**
* GdkSeat:display:
*
* #GdkDisplay of this seat.
@@ -389,3 +433,29 @@ gdk_seat_get_display (GdkSeat *seat)
return priv->display;
}
+
+void
+gdk_seat_tool_added (GdkSeat *seat,
+ GdkDeviceTool *tool)
+{
+ g_signal_emit (seat, signals[TOOL_ADDED], 0, tool);
+}
+
+void
+gdk_seat_tool_removed (GdkSeat *seat,
+ GdkDeviceTool *tool)
+{
+ g_signal_emit (seat, signals[TOOL_REMOVED], 0, tool);
+}
+
+GdkDeviceTool *
+gdk_seat_get_tool (GdkSeat *seat,
+ guint64 serial)
+{
+ GdkSeatClass *seat_class;
+
+ g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
+
+ seat_class = GDK_SEAT_GET_CLASS (seat);
+ return seat_class->get_tool (seat, serial);
+}
diff --git a/gdk/gdkseatprivate.h b/gdk/gdkseatprivate.h
index f8d84c8..bd66f68 100644
--- a/gdk/gdkseatprivate.h
+++ b/gdk/gdkseatprivate.h
@@ -55,6 +55,9 @@ struct _GdkSeatClass
GdkSeatCapabilities capability);
GList * (* get_slaves) (GdkSeat *seat,
GdkSeatCapabilities capabilities);
+
+ GdkDeviceTool * (* get_tool) (GdkSeat *seat,
+ guint64 serial);
};
void gdk_seat_device_added (GdkSeat *seat,
@@ -62,4 +65,13 @@ void gdk_seat_device_added (GdkSeat *seat,
void gdk_seat_device_removed (GdkSeat *seat,
GdkDevice *device);
+void gdk_seat_tool_added (GdkSeat *seat,
+ GdkDeviceTool *tool);
+void gdk_seat_tool_removed (GdkSeat *seat,
+ GdkDeviceTool *tool);
+
+GdkDeviceTool *
+ gdk_seat_get_tool (GdkSeat *seat,
+ guint64 serial);
+
#endif /* __GDK_SEAT_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]