Attempt to improve mouse cloning
This commit is contained in:
parent
e522069584
commit
3049221d61
|
|
@ -26,4 +26,4 @@ popd
|
|||
|
||||
pushd $DATA_DIR
|
||||
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" > manifest
|
||||
popd
|
||||
popd
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ import Globals from './globals.js';
|
|||
|
||||
// Taken from https://github.com/jkitching/soft-brightness-plus
|
||||
export class CursorManager {
|
||||
constructor(mainActor) {
|
||||
constructor(mainActor, refreshRate) {
|
||||
this._mainActor = mainActor;
|
||||
this._refreshRate = refreshRate;
|
||||
|
||||
this._changeHookFn = null;
|
||||
|
||||
|
|
@ -26,7 +27,6 @@ export class CursorManager {
|
|||
this._cursorWatch = null;
|
||||
this._cursorChangedConnection = null;
|
||||
this._cursorVisibilityChangedConnection = null;
|
||||
this._cursorPositionInvalidatedConnection = null;
|
||||
}
|
||||
|
||||
enable() {
|
||||
|
|
@ -130,10 +130,9 @@ 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));
|
||||
this._cursorVisibilityChangedConnection = this._cursorTracker.connect('visibility-changed', this._handleVisibilityChanged.bind(this));
|
||||
|
||||
const interval = 1000 / 250;
|
||||
const interval = 1000 / this._refreshRate;
|
||||
this._cursorWatch = this._cursorWatcher.addWatch(interval, this._updateMousePosition.bind(this));
|
||||
|
||||
const [x, y] = global.get_pointer();
|
||||
|
|
@ -164,14 +163,15 @@ export class CursorManager {
|
|||
this._cursorWatch.remove();
|
||||
this._cursorWatch = null;
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorChangedConnection);
|
||||
this._cursorChangedConnection = null;
|
||||
if (this._cursorChangedConnection) {
|
||||
this._cursorTracker.disconnect(this._cursorChangedConnection);
|
||||
this._cursorChangedConnection = null;
|
||||
}
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection);
|
||||
this._cursorVisibilityChangedConnection = null;
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorPositionInvalidatedConnection);
|
||||
this._cursorPositionInvalidatedConnection = null;
|
||||
if (this._cursorVisibilityChangedConnection) {
|
||||
this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection);
|
||||
this._cursorVisibilityChangedConnection = null;
|
||||
}
|
||||
|
||||
if (Clutter.Container === undefined) {
|
||||
this._mainActor.remove_child(this._cursorActor);
|
||||
|
|
@ -180,10 +180,6 @@ export class CursorManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (this._cursorTracker.set_keep_focus_while_hidden) {
|
||||
this._cursorTracker.set_keep_focus_while_hidden(false);
|
||||
}
|
||||
|
||||
if (this._cursorUnfocusInhibited) {
|
||||
Globals.logger.log_debug('uninhibit_unfocus');
|
||||
this._cursorSeat.uninhibit_unfocus();
|
||||
|
|
@ -209,8 +205,6 @@ export class CursorManager {
|
|||
translation_x: -xHot,
|
||||
translation_y: -yHot,
|
||||
});
|
||||
this._mainActor.set_child_above_sibling(this._cursorActor, null);
|
||||
this._cursorTrackerSetPointerVisibleBound(false);
|
||||
|
||||
// some other processes are uninhibiting when they shouldn't, so we need to re-inhibit here
|
||||
if (!this._cursorSeat.is_unfocus_inhibited() && this._cursorUnfocusInhibited) {
|
||||
|
|
@ -218,4 +212,12 @@ export class CursorManager {
|
|||
this._cursorSeat.inhibit_unfocus();
|
||||
}
|
||||
}
|
||||
|
||||
_handleVisibilityChanged() {
|
||||
this._cursorTrackerSetPointerVisibleBound(false);
|
||||
}
|
||||
|
||||
handleStageChildAdded() {
|
||||
this._mainActor.set_child_above_sibling(this._cursorActor, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._widescreen_mode_connection = null;
|
||||
this._start_binding = null;
|
||||
this._end_binding = null;
|
||||
this._stage_child_connection = null;
|
||||
this._curved_display_binding = null;
|
||||
this._display_size_binding = null;
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._is_effect_running = true;
|
||||
|
||||
try {
|
||||
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup);
|
||||
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup, this._refresh_rate);
|
||||
this._cursor_manager.enable();
|
||||
|
||||
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);'});
|
||||
|
|
@ -199,6 +200,11 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._end_binding = this.settings.bind('toggle-display-distance-end', this._xr_effect, 'toggle-display-distance-end', Gio.SettingsBindFlags.DEFAULT)
|
||||
this._curved_display_binding = this.settings.bind('curved-display', this._xr_effect, 'curved-display', Gio.SettingsBindFlags.DEFAULT)
|
||||
this._display_size_binding = this.settings.bind('widescreen-display-size', this._xr_effect, 'widescreen-display-size', Gio.SettingsBindFlags.DEFAULT)
|
||||
if (Clutter.Container === undefined) {
|
||||
this._stage_child_connection = global.stage.connect('child-added', this._cursor_manager.handleStageChildAdded);
|
||||
} else {
|
||||
this._stage_child_connection = global.stage.connect('actor-added', this._cursor_manager.handleStageChildAdded);
|
||||
}
|
||||
|
||||
this._overlay.add_effect_with_name('xr-desktop', this._xr_effect);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
|
|
@ -332,6 +338,10 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this.settings.unbind(this._display_size_binding);
|
||||
this._display_size_binding = null;
|
||||
}
|
||||
if (this._stage_child_connection) {
|
||||
global.stage.disconnect(this._stage_child_connection);
|
||||
this._stage_child_connection = null;
|
||||
}
|
||||
if (this._xr_effect) {
|
||||
this._xr_effect.cleanup();
|
||||
this._xr_effect = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue