backend: Only create idle monitors for added physical input devices

The rest of the things we do aren't applicable, e.g. mapping tablet
devices/tools to monitors and hiding cursors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1688>
This commit is contained in:
Jonas Ådahl 2021-01-28 15:04:11 +01:00 committed by Marge Bot
parent e6b70f1a2b
commit 5e34ae2154

View File

@ -409,13 +409,6 @@ meta_backend_monitor_device (MetaBackend *backend,
create_device_monitor (backend, device); create_device_monitor (backend, device);
} }
static inline gboolean
device_is_physical_touchscreen (ClutterInputDevice *device)
{
return (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE);
}
static inline gboolean static inline gboolean
check_has_pointing_device (ClutterSeat *seat) check_has_pointing_device (ClutterSeat *seat)
{ {
@ -454,11 +447,15 @@ on_device_added (ClutterSeat *seat,
create_device_monitor (backend, device); create_device_monitor (backend, device);
if (device_is_physical_touchscreen (device)) if (clutter_input_device_get_device_mode (device) ==
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE); CLUTTER_INPUT_MODE_LOGICAL)
return;
device_type = clutter_input_device_get_device_type (device); device_type = clutter_input_device_get_device_type (device);
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE);
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE || if (device_type == CLUTTER_TOUCHSCREEN_DEVICE ||
device_type == CLUTTER_TABLET_DEVICE || device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE || device_type == CLUTTER_PEN_DEVICE ||
@ -478,6 +475,10 @@ on_device_removed (ClutterSeat *seat,
destroy_device_monitor (backend, device); destroy_device_monitor (backend, device);
if (clutter_input_device_get_device_mode (device) ==
CLUTTER_INPUT_MODE_LOGICAL)
return;
meta_input_mapper_remove_device (priv->input_mapper, device); meta_input_mapper_remove_device (priv->input_mapper, device);
/* If the device the user last interacted goes away, check again pointer /* If the device the user last interacted goes away, check again pointer