mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
backend: Update cursor visibility on device added
Not calling libinput dispatch in the backend constructor defeats the logic in post init as the device added events have not been processed yet. So instead of trying to guess the cursor initial visibility, simply update it along when devices get added. Additional benefit, we do not need to walk the all device list looking for touchscreens anymore, we just need to check the device being added since the current logic is to hide the cursor as soon as a touchscreen is found. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1534
This commit is contained in:
parent
c618b8a0eb
commit
9b88172982
@ -350,16 +350,6 @@ meta_backend_monitor_device (MetaBackend *backend,
|
||||
create_device_monitor (backend, device);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_added (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (user_data);
|
||||
|
||||
create_device_monitor (backend, device);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
device_is_physical_touchscreen (ClutterInputDevice *device)
|
||||
{
|
||||
@ -394,6 +384,20 @@ check_has_pointing_device (ClutterSeat *seat)
|
||||
return found;
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_added (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (user_data);
|
||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||
|
||||
create_device_monitor (backend, device);
|
||||
|
||||
if (device_is_physical_touchscreen (device))
|
||||
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_removed (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
@ -457,27 +461,6 @@ create_device_monitors (MetaBackend *backend,
|
||||
g_list_free (devices);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_pointer_visibility (MetaBackend *backend,
|
||||
ClutterSeat *seat)
|
||||
{
|
||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||
GList *l, *devices;
|
||||
gboolean has_touchscreen = FALSE;
|
||||
|
||||
devices = clutter_seat_list_devices (seat);
|
||||
for (l = devices; l; l = l->next)
|
||||
{
|
||||
ClutterInputDevice *device = l->data;
|
||||
|
||||
has_touchscreen |= device_is_physical_touchscreen (device);
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker,
|
||||
!has_touchscreen);
|
||||
}
|
||||
|
||||
static MetaInputSettings *
|
||||
meta_backend_create_input_settings (MetaBackend *backend)
|
||||
{
|
||||
@ -512,8 +495,6 @@ meta_backend_real_post_init (MetaBackend *backend)
|
||||
G_CALLBACK (on_device_removed), backend,
|
||||
G_CONNECT_AFTER);
|
||||
|
||||
set_initial_pointer_visibility (backend, seat);
|
||||
|
||||
priv->input_settings = meta_backend_create_input_settings (backend);
|
||||
|
||||
if (priv->input_settings)
|
||||
|
Loading…
Reference in New Issue
Block a user