[mutter] backend: Only create idle monitors for added physical input devices



commit 5e34ae2154e0e7b5162fb2948f3f98cf66994184
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Jan 28 15:04:11 2021 +0100

    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>

 src/backends/meta-backend.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 14f15d66a2..def62c49aa 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -409,13 +409,6 @@ meta_backend_monitor_device (MetaBackend        *backend,
   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
 check_has_pointing_device (ClutterSeat *seat)
 {
@@ -454,11 +447,15 @@ on_device_added (ClutterSeat        *seat,
 
   create_device_monitor (backend, device);
 
-  if (device_is_physical_touchscreen (device))
-    meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE);
+  if (clutter_input_device_get_device_mode (device) ==
+      CLUTTER_INPUT_MODE_LOGICAL)
+    return;
 
   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 ||
       device_type == CLUTTER_TABLET_DEVICE ||
       device_type == CLUTTER_PEN_DEVICE ||
@@ -478,6 +475,10 @@ on_device_removed (ClutterSeat        *seat,
 
   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);
 
   /* If the device the user last interacted goes away, check again pointer


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]