diff --git a/cursor.js b/cursor.js index b0bb0a1..c1d2747 100644 --- a/cursor.js +++ b/cursor.js @@ -1,10 +1,9 @@ 'use strict'; -import Clutter from 'gi://Clutter'; - export default class Cursor { constructor() { - this._tracker = global.backend.get_cursor_tracker(global.display); + this._tracker = global.backend.get_cursor_tracker(); + this._isHidden = false; } get hot() { @@ -16,32 +15,16 @@ export default class Cursor { } show() { - const seat = Clutter.get_default_backend().get_default_seat(); - - if (seat.is_unfocus_inhibited()) { - seat.uninhibit_unfocus(); + if (this._isHidden) { + this._tracker.uninhibit_cursor_visibility(); + this._isHidden = false; } - - this._tracker.disconnectObject(this); - this._tracker.set_pointer_visible(true); } hide() { - const seat = Clutter.get_default_backend().get_default_seat(); - - if (!seat.is_unfocus_inhibited()) { - seat.inhibit_unfocus(); + if (!this._isHidden) { + this._tracker.inhibit_cursor_visibility(); + this._isHidden = true; } - - this._tracker.set_pointer_visible(false); - this._tracker.disconnectObject(this); - this._tracker.connectObject( - 'visibility-changed', () => { - if (this._tracker.get_pointer_visible()) { - this._tracker.set_pointer_visible(false); - } - }, - this - ); } -} +} \ No newline at end of file diff --git a/effect.js b/effect.js index f35c356..fc75e71 100644 --- a/effect.js +++ b/effect.js @@ -54,7 +54,7 @@ export default class Effect extends St.Icon { this.remove_all_transitions(); this.ease({ duration: this.magnifyDuration, - transition: Clutter.AnimationMode.EASE_IN_QUAD, + mode: Clutter.AnimationMode.EASE_IN_QUAD, scale_x: 1.0, scale_y: 1.0, pivot_point: this._pivot, diff --git a/extension.js b/extension.js index 12e21c8..7f824ab 100644 --- a/extension.js +++ b/extension.js @@ -57,10 +57,17 @@ export default class WiggleExtension extends Extension { return false; } + _removeDrawWatch() { + if (this._drawIntervalWatch && this._pointerWatcher._removeWatch) { + this._pointerWatcher._removeWatch(this._drawIntervalWatch); + } + this._drawIntervalWatch = null; + } + _onDrawIntervalChange(interval) { this._drawInterval = interval; if (this._drawIntervalWatch) { - this._pointerWatcher._removeWatch(this._drawIntervalWatch); + this._removeDrawWatch(); } this._drawIntervalWatch = this._pointerWatcher.addWatch(interval, (x, y) => { this._history.push(x, y); @@ -80,8 +87,7 @@ export default class WiggleExtension extends Extension { this._effect.unmagnify(); } if (this._drawIntervalWatch) { - this._pointerWatcher._removeWatch(this._drawIntervalWatch); - this._drawIntervalWatch = null; + this._removeDrawWatch(); this._history.clear(); } } diff --git a/metadata.json b/metadata.json index 50fff44..435f2e5 100644 --- a/metadata.json +++ b/metadata.json @@ -4,7 +4,9 @@ "shell-version": [ "46", "47", - "48" + "48", + "49", + "50" ], "url": "https://github.com/mechtifs/wiggle", "uuid": "wiggle@mechtifs",