Commit 7531be35 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Matthias Clasen

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
parent 4c45022e
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment