[mutter] backend: Update cursor visibility on device added
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backend: Update cursor visibility on device added
- Date: Fri, 30 Oct 2020 18:39:39 +0000 (UTC)
commit 9b881729821b360cc6e6f06f37fee0fe9b417a27
Author: Olivier Fourdan <ofourdan redhat com>
Date: Fri Oct 30 15:44:52 2020 +0100
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
src/backends/meta-backend.c | 47 ++++++++++++++-------------------------------
1 file changed, 14 insertions(+), 33 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index d8e691f3be..1770ad795a 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]