mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
wayland: Set wayland seat capabilities based on input device capabilities
Instead of looking at device types, which might be incomplete. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2154 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
This commit is contained in:
parent
1fda60f03e
commit
844a729fa9
@ -114,7 +114,7 @@ lookup_device_capabilities (ClutterSeat *seat)
|
||||
|
||||
for (l = devices; l; l = l->next)
|
||||
{
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputCapabilities device_capabilities;
|
||||
|
||||
/* Only look for physical devices, logical devices have rather generic
|
||||
* keyboard/pointer device types, which is not truly representative of
|
||||
@ -123,26 +123,14 @@ lookup_device_capabilities (ClutterSeat *seat)
|
||||
if (clutter_input_device_get_device_mode (l->data) == CLUTTER_INPUT_MODE_LOGICAL)
|
||||
continue;
|
||||
|
||||
device_type = clutter_input_device_get_device_type (l->data);
|
||||
device_capabilities = clutter_input_device_get_capabilities (l->data);
|
||||
|
||||
switch (device_type)
|
||||
{
|
||||
case CLUTTER_TOUCHPAD_DEVICE:
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
if (device_capabilities & CLUTTER_INPUT_CAPABILITY_POINTER)
|
||||
capabilities |= WL_SEAT_CAPABILITY_POINTER;
|
||||
break;
|
||||
case CLUTTER_KEYBOARD_DEVICE:
|
||||
if (device_capabilities & CLUTTER_INPUT_CAPABILITY_KEYBOARD)
|
||||
capabilities |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
break;
|
||||
case CLUTTER_TOUCHSCREEN_DEVICE:
|
||||
if (device_capabilities & CLUTTER_INPUT_CAPABILITY_TOUCH)
|
||||
capabilities |= WL_SEAT_CAPABILITY_TOUCH;
|
||||
break;
|
||||
default:
|
||||
g_debug ("Ignoring device '%s' with unhandled type %d",
|
||||
clutter_input_device_get_device_name (l->data),
|
||||
device_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
@ -299,7 +287,7 @@ event_from_supported_hardware_device (MetaWaylandSeat *seat,
|
||||
{
|
||||
ClutterInputDevice *input_device;
|
||||
ClutterInputMode input_mode;
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputCapabilities capabilities;
|
||||
gboolean hardware_device = FALSE;
|
||||
gboolean supported_device = FALSE;
|
||||
|
||||
@ -315,21 +303,13 @@ event_from_supported_hardware_device (MetaWaylandSeat *seat,
|
||||
|
||||
hardware_device = TRUE;
|
||||
|
||||
device_type = clutter_input_device_get_device_type (input_device);
|
||||
capabilities = clutter_input_device_get_capabilities (input_device);
|
||||
|
||||
switch (device_type)
|
||||
{
|
||||
case CLUTTER_TOUCHPAD_DEVICE:
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
case CLUTTER_KEYBOARD_DEVICE:
|
||||
case CLUTTER_TOUCHSCREEN_DEVICE:
|
||||
if ((capabilities &
|
||||
(CLUTTER_INPUT_CAPABILITY_POINTER |
|
||||
CLUTTER_INPUT_CAPABILITY_KEYBOARD |
|
||||
CLUTTER_INPUT_CAPABILITY_TOUCH)) != 0)
|
||||
supported_device = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
supported_device = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
return hardware_device && supported_device;
|
||||
|
Loading…
Reference in New Issue
Block a user