[mutter/wip/carlosg/there-can-be-only-one: 2/3] backends: Keep cursor hidden on tablet input on Wayland



commit 83f496229b06f07ee8eda669f6a36a09c691d1b5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Nov 2 15:50:12 2018 +0100

    backends: Keep cursor hidden on tablet input on Wayland
    
    Tablets have their own cursor, in order to avoid confusions just
    hide the regular pointer like we do on touchscreens, so there's
    the illusion that there is a single cursor.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/issues/75

 src/backends/meta-backend.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index afbb41dc7..84da437bd 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -309,6 +309,9 @@ check_has_pointing_device (ClutterDeviceManager *manager)
       if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
           clutter_input_device_get_device_type (device) == CLUTTER_KEYBOARD_DEVICE)
         continue;
+      if (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
+          meta_is_wayland_compositor ())
+        continue;
 
       return TRUE;
     }
@@ -328,8 +331,12 @@ check_pointer_visibility (ClutterDeviceManager *manager)
     {
       ClutterInputDevice *device = devices->data;
 
-      if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
-          clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE)
+      if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_SLAVE)
+        continue;
+
+      if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
+          (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
+           meta_is_wayland_compositor ()))
         {
           pointer_visible = FALSE;
           break;
@@ -1032,6 +1039,12 @@ update_last_device (MetaBackend *backend)
     {
     case CLUTTER_KEYBOARD_DEVICE:
       break;
+    case CLUTTER_TABLET_DEVICE:
+      if (meta_is_wayland_compositor ())
+        meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
+      else
+        meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
+      break;
     case CLUTTER_TOUCHSCREEN_DEVICE:
       meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
       break;


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