From b6c913ddb2831453d21a7a236639ff7885122de3 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:10:08 -0700 Subject: [PATCH] Tinker with cloned cursor initialization, probably not final --- .../cursormanager.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gnome/breezydesktop@org.xronlinux/cursormanager.js b/gnome/breezydesktop@org.xronlinux/cursormanager.js index 9f16125..504f129 100644 --- a/gnome/breezydesktop@org.xronlinux/cursormanager.js +++ b/gnome/breezydesktop@org.xronlinux/cursormanager.js @@ -29,18 +29,6 @@ export class CursorManager { } enable() { - // First 500ms: For some reason, starting the mouse cloning at this - // stage fails when gnome-shell is restarting on x11 and the mouse - // listener doesn't receive any events. Adding a small delay before - // starting the whole mouse cloning business helps. - this._enableTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => { - this._enableTimeoutId = null; - this._enable(); - return GLib.SOURCE_REMOVE; - }); - } - - _enable() { this._enableCloningMouse(); this.startCloning(); } @@ -137,9 +125,12 @@ export class CursorManager { this._mainActor.add_actor(this._cursorActor); this._cursorChangedConnection = this._cursorTracker.connect('cursor-changed', this._updateMouseSprite.bind(this)); this._cursorVisibilityChangedConnection = this._cursorTracker.connect('visibility-changed', this._updateMouseSprite.bind(this)); + this._cursorPositionInvalidatedConnection = this._cursorTracker.connect('position-invalidated', this._updateMouseSprite.bind(this)); const interval = 1000 / 100; this._cursorWatch = this._cursorWatcher.addWatch(interval, this._updateMousePosition.bind(this)); + const [x, y] = global.get_pointer(); + this._updateMousePosition(x, y); this._updateMouseSprite(); } @@ -169,6 +160,9 @@ export class CursorManager { this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection); this._cursorVisibilityChangedConnection = null; + this._cursorTracker.disconnect(this._cursorPositionInvalidatedConnection); + this._cursorPositionInvalidatedConnection = null; + this._mainActor.remove_actor(this._cursorActor); }