Tinker with cloned cursor initialization, probably not final

This commit is contained in:
wheaney 2024-04-13 22:10:08 -07:00
parent 3ba8a98169
commit b6c913ddb2
1 changed files with 6 additions and 12 deletions

View File

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