backends: Keep cursor hidden on tablet input on Wayland

Tablets have their own cursor, in order to avoid confusions just
hide the regular pointer like we do on touchscreens, so there's
the illusion that there is a single cursor.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/75
This commit is contained in:
Carlos Garnacho 2018-11-02 15:50:12 +01:00
parent 0fea0e383c
commit 83f496229b

View File

@ -309,6 +309,9 @@ check_has_pointing_device (ClutterDeviceManager *manager)
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_device_type (device) == CLUTTER_KEYBOARD_DEVICE)
continue;
if (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
meta_is_wayland_compositor ())
continue;
return TRUE;
}
@ -328,8 +331,12 @@ check_pointer_visibility (ClutterDeviceManager *manager)
{
ClutterInputDevice *device = devices->data;
if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE)
if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_SLAVE)
continue;
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
(clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
meta_is_wayland_compositor ()))
{
pointer_visible = FALSE;
break;
@ -1032,6 +1039,12 @@ update_last_device (MetaBackend *backend)
{
case CLUTTER_KEYBOARD_DEVICE:
break;
case CLUTTER_TABLET_DEVICE:
if (meta_is_wayland_compositor ())
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
else
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;