magnifier: Keep accounting of own cursor unfocus inhibition

Do not rely on global state since there may be more users of it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3028>
This commit is contained in:
Carlos Garnacho 2023-11-24 00:28:39 +01:00 committed by Marge Bot
parent 14db121ce5
commit 412081a689

View File

@ -126,6 +126,7 @@ export class Magnifier extends Signals.EventEmitter {
});
this.setActive(St.Settings.get().magnifier_active);
this._cursorUnfocusInhibited = false;
}
/**
@ -135,8 +136,10 @@ export class Magnifier extends Signals.EventEmitter {
showSystemCursor() {
const seat = Clutter.get_default_backend().get_default_seat();
if (seat.is_unfocus_inhibited())
if (this._cursorUnfocusInhibited) {
seat.uninhibit_unfocus();
this._cursorUnfocusInhibited = false;
}
if (this._cursorVisibilityChangedId) {
this._cursorTracker.disconnect(this._cursorVisibilityChangedId);
@ -153,8 +156,10 @@ export class Magnifier extends Signals.EventEmitter {
hideSystemCursor() {
const seat = Clutter.get_default_backend().get_default_seat();
if (!seat.is_unfocus_inhibited())
if (!this._cursorUnfocusInhibited) {
seat.inhibit_unfocus();
this._cursorUnfocusInhibited = true;
}
if (!this._cursorVisibilityChangedId) {
this._cursorTracker.set_pointer_visible(false);