magnifier: Use inhibit-unfocus API to keep wayland focus while hidden

Since commit mutter/a2a8f0cda we force the focus surface of the
meta-wayland-pointer to NULL while the pointer is hidden. This
introduced an issue with the magnifier, where we use
`set_pointer_visible` to hide the real cursor and show our own cursor at
the correct position: Because the meta-wayland-pointer is still used to
communicate with Wayland clients, the UI of the windows will not respond
to mouse movement anymore as soon as the real cursor is hidden.

To fix this, use the newly added clutter_seat_inhibit_unfocus() API to
temporarily disable unsetting the focus-surface while the magnifier is
hiding the system cursor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/993
This commit is contained in:
Jonas Dreßler 2019-10-07 15:02:17 +02:00 committed by verdre
parent 725c72e020
commit 3848513cf4

View File

@ -127,6 +127,10 @@ var Magnifier = class Magnifier {
* Show the system mouse pointer. * Show the system mouse pointer.
*/ */
showSystemCursor() { showSystemCursor() {
const seat = Clutter.get_default_backend().get_default_seat();
if (seat.is_unfocus_inhibited())
seat.uninhibit_unfocus();
this._cursorTracker.set_pointer_visible(true); this._cursorTracker.set_pointer_visible(true);
} }
@ -135,6 +139,10 @@ var Magnifier = class Magnifier {
* Hide the system mouse pointer. * Hide the system mouse pointer.
*/ */
hideSystemCursor() { hideSystemCursor() {
const seat = Clutter.get_default_backend().get_default_seat();
if (!seat.is_unfocus_inhibited())
seat.inhibit_unfocus();
this._cursorTracker.set_pointer_visible(false); this._cursorTracker.set_pointer_visible(false);
} }