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); }