[mutter/wip/carlosg/pointer-lock-checks: 71/72] wayland: Check pointer visibility on post-grab focus changes



commit 7735a919d184d21613eda5d02ec504e0f7c56922
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 12 19:18:44 2019 +0200

    wayland: Check pointer visibility on post-grab focus changes
    
    Just like sync_focus_surface() does, we shouldn't set a focus surface while
    the pointer is hidden, so the illusion that there is none remains.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779

 src/wayland/meta-wayland-pointer.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index e8f0be4c6..751f6b9b9 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -427,6 +427,14 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
   MetaWaylandPointer *pointer = grab->pointer;
   MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
   MetaDisplay *display = meta_get_display ();
+  MetaBackend *backend = meta_get_backend ();
+  MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
+
+  if (!meta_wayland_seat_has_pointer (seat))
+    return;
+
+  if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker))
+    return;
 
   if (pointer->button_count > 0)
     return;
@@ -444,8 +452,7 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
       break;
     }
 
-  if (meta_wayland_seat_has_pointer (seat))
-    meta_wayland_pointer_set_focus (pointer, surface);
+  meta_wayland_pointer_set_focus (pointer, surface);
 }
 
 static void


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