[mutter/gnome-3-38] backend: Update cursor visibility on device added
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-38] backend: Update cursor visibility on device added
- Date: Mon, 2 Nov 2020 13:07:15 +0000 (UTC)
commit 33605179a4a3c9d84e6f87b5c8cafa7d677eba0c
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
(cherry picked from commit 9b881729821b360cc6e6f06f37fee0fe9b417a27)
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 9c61a02b9a..9f9dba5baf 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)
{
@@ -419,6 +409,20 @@ check_has_physical_touchscreen (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,
@@ -482,27 +486,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)
{
@@ -537,8 +520,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]