[gtk+] gdk: Add GDK_SEAT_CAPABILITY_TABLET_PAD
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Add GDK_SEAT_CAPABILITY_TABLET_PAD
- Date: Fri, 8 Dec 2017 02:27:59 +0000 (UTC)
commit 7531be3510baf4d2ded80b780ff1c02f268bfcb0
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Nov 27 21:39:05 2017 +0100
gdk: Add GDK_SEAT_CAPABILITY_TABLET_PAD
Tablet pads don't adapt really well to any other capability, so add a
distinct one to be able to query those properly.
https://bugzilla.gnome.org/show_bug.cgi?id=790920
gdk/gdkseat.h | 4 +++-
gdk/gdkseatdefault.c | 12 +++++++-----
gdk/wayland/gdkdevice-wayland.c | 11 +++++++++++
3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdkseat.h b/gdk/gdkseat.h
index f60b93d..c7bc64d 100644
--- a/gdk/gdkseat.h
+++ b/gdk/gdkseat.h
@@ -42,6 +42,7 @@ G_BEGIN_DECLS
* @GDK_SEAT_CAPABILITY_TOUCH: The seat has touchscreen(s) attached
* @GDK_SEAT_CAPABILITY_TABLET_STYLUS: The seat has drawing tablet(s) attached
* @GDK_SEAT_CAPABILITY_KEYBOARD: The seat has keyboard(s) attached
+ * @GDK_SEAT_CAPABILITY_TABLET_PAD: The seat has drawing tablet pad(s) attached
* @GDK_SEAT_CAPABILITY_ALL_POINTING: The union of all pointing capabilities
* @GDK_SEAT_CAPABILITY_ALL: The union of all capabilities
*
@@ -55,6 +56,7 @@ typedef enum {
GDK_SEAT_CAPABILITY_TOUCH = 1 << 1,
GDK_SEAT_CAPABILITY_TABLET_STYLUS = 1 << 2,
GDK_SEAT_CAPABILITY_KEYBOARD = 1 << 3,
+ GDK_SEAT_CAPABILITY_TABLET_PAD = 1 << 4,
GDK_SEAT_CAPABILITY_ALL_POINTING = (GDK_SEAT_CAPABILITY_POINTER | GDK_SEAT_CAPABILITY_TOUCH |
GDK_SEAT_CAPABILITY_TABLET_STYLUS),
GDK_SEAT_CAPABILITY_ALL = (GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD)
} GdkSeatCapabilities;
@@ -112,7 +114,7 @@ GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
GDK_AVAILABLE_IN_3_20
GdkDevice * gdk_seat_get_keyboard (GdkSeat *seat);
-GDK_AVAILABLE_IN_3_93
+GDK_AVAILABLE_IN_3_94
GList * gdk_seat_get_master_pointers (GdkSeat *seat,
GdkSeatCapabilities capabilities);
diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c
index bf3f410..382cc04 100644
--- a/gdk/gdkseatdefault.c
+++ b/gdk/gdkseatdefault.c
@@ -226,10 +226,11 @@ device_get_capability (GdkDevice *device)
case GDK_SOURCE_ERASER:
case GDK_SOURCE_CURSOR:
return GDK_SEAT_CAPABILITY_TABLET_STYLUS;
+ case GDK_SOURCE_TABLET_PAD:
+ return GDK_SEAT_CAPABILITY_TABLET_PAD;
case GDK_SOURCE_MOUSE:
case GDK_SOURCE_TOUCHPAD:
case GDK_SOURCE_TRACKPOINT:
- case GDK_SOURCE_TABLET_PAD:
default:
return GDK_SEAT_CAPABILITY_POINTER;
}
@@ -269,7 +270,7 @@ gdk_seat_default_get_slaves (GdkSeat *seat,
if (capabilities & (GDK_SEAT_CAPABILITY_ALL_POINTING))
devices = append_filtered (devices, priv->slave_pointers, capabilities);
- if (capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
+ if (capabilities & (GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD))
devices = append_filtered (devices, priv->slave_keyboards, capabilities);
return devices;
@@ -375,7 +376,7 @@ gdk_seat_default_add_slave (GdkSeatDefault *seat,
if (capability & GDK_SEAT_CAPABILITY_ALL_POINTING)
priv->slave_pointers = g_list_prepend (priv->slave_pointers, g_object_ref (device));
- else if (capability & GDK_SEAT_CAPABILITY_KEYBOARD)
+ else if (capability & (GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD))
priv->slave_keyboards = g_list_prepend (priv->slave_keyboards, g_object_ref (device));
else
{
@@ -415,8 +416,9 @@ gdk_seat_default_remove_slave (GdkSeatDefault *seat,
{
priv->slave_keyboards = g_list_remove (priv->slave_keyboards, device);
- if (priv->slave_keyboards == NULL)
- priv->capabilities &= ~GDK_SEAT_CAPABILITY_KEYBOARD;
+ priv->capabilities &= ~(GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD);
+ for (l = priv->slave_keyboards; l; l = l->next)
+ priv->capabilities |= device_get_capability (GDK_DEVICE (l->data));
gdk_seat_device_removed (GDK_SEAT (seat), device);
}
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 02f9418..b1d0a00 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -4711,6 +4711,17 @@ gdk_wayland_seat_get_slaves (GdkSeat *seat,
}
}
+ if (wayland_seat->tablet_pads && (capabilities & GDK_SEAT_CAPABILITY_TABLET_PAD))
+ {
+ GList *l;
+
+ for (l = wayland_seat->tablet_pads; l; l = l->next)
+ {
+ GdkWaylandTabletPadData *data = l->data;
+ slaves = g_list_prepend (slaves, data->device);
+ }
+ }
+
return slaves;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]