Compare commits
7 Commits
main
...
v0.9-sbs-1
| Author | SHA1 | Date |
|---|---|---|
|
|
f6f5bbf6cc | |
|
|
53eee5cf7a | |
|
|
8a35af00e4 | |
|
|
57a659b2a3 | |
|
|
3049221d61 | |
|
|
e522069584 | |
|
|
f2aa65c37d |
|
|
@ -5,9 +5,11 @@
|
||||||
[submodule "modules/XRLinuxDriver"]
|
[submodule "modules/XRLinuxDriver"]
|
||||||
path = modules/XRLinuxDriver
|
path = modules/XRLinuxDriver
|
||||||
url = https://github.com/wheaney/XRLinuxDriver.git
|
url = https://github.com/wheaney/XRLinuxDriver.git
|
||||||
|
branch = breezy_sbs
|
||||||
[submodule "modules/sombrero"]
|
[submodule "modules/sombrero"]
|
||||||
path = modules/sombrero
|
path = modules/sombrero
|
||||||
url = https://github.com/wheaney/sombrero.git
|
url = https://github.com/wheaney/sombrero.git
|
||||||
|
branch = breezy_sbs
|
||||||
[submodule "ui/modules/PyXRLinuxDriverIPC"]
|
[submodule "ui/modules/PyXRLinuxDriverIPC"]
|
||||||
path = ui/modules/PyXRLinuxDriverIPC
|
path = ui/modules/PyXRLinuxDriverIPC
|
||||||
url = https://github.com/wheaney/PyXRLinuxDriverIPC.git
|
url = https://github.com/wheaney/PyXRLinuxDriverIPC.git
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||||
if [ -z "$XDG_DATA_HOME" ]; then
|
if [ -z "$XDG_DATA_HOME" ]; then
|
||||||
XDG_DATA_HOME="$USER_HOME/.local/share"
|
XDG_DATA_HOME="$USER_HOME/.local/share"
|
||||||
fi
|
fi
|
||||||
|
DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
|
||||||
|
|
||||||
# if $XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com exists
|
# if $XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com exists
|
||||||
extension_path="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
|
extension_path="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
|
||||||
|
|
@ -18,3 +19,11 @@ fi
|
||||||
cp -rL $SCRIPT_DIR/../../src $extension_path
|
cp -rL $SCRIPT_DIR/../../src $extension_path
|
||||||
|
|
||||||
glib-compile-schemas $extension_path/schemas
|
glib-compile-schemas $extension_path/schemas
|
||||||
|
|
||||||
|
pushd $extension_path
|
||||||
|
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd $DATA_DIR
|
||||||
|
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" > manifest
|
||||||
|
popd
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import Clutter from 'gi://Clutter';
|
import Clutter from 'gi://Clutter';
|
||||||
|
import GLib from 'gi://GLib';
|
||||||
import Meta from 'gi://Meta';
|
import Meta from 'gi://Meta';
|
||||||
import * as PointerWatcher from 'resource:///org/gnome/shell/ui/pointerWatcher.js';
|
import * as PointerWatcher from 'resource:///org/gnome/shell/ui/pointerWatcher.js';
|
||||||
import { MouseSpriteContent } from './cursor.js';
|
import { MouseSpriteContent } from './cursor.js';
|
||||||
|
|
@ -6,8 +7,9 @@ import Globals from './globals.js';
|
||||||
|
|
||||||
// Taken from https://github.com/jkitching/soft-brightness-plus
|
// Taken from https://github.com/jkitching/soft-brightness-plus
|
||||||
export class CursorManager {
|
export class CursorManager {
|
||||||
constructor(mainActor) {
|
constructor(mainActor, refreshRate) {
|
||||||
this._mainActor = mainActor;
|
this._mainActor = mainActor;
|
||||||
|
this._refreshRate = refreshRate;
|
||||||
|
|
||||||
this._changeHookFn = null;
|
this._changeHookFn = null;
|
||||||
|
|
||||||
|
|
@ -18,15 +20,14 @@ export class CursorManager {
|
||||||
this._cursorTrackerSetPointerVisibleBound = null;
|
this._cursorTrackerSetPointerVisibleBound = null;
|
||||||
this._cursorSprite = null;
|
this._cursorSprite = null;
|
||||||
this._cursorActor = null;
|
this._cursorActor = null;
|
||||||
this._cursorWatcher = null;
|
|
||||||
this._cursorSeat = null;
|
this._cursorSeat = null;
|
||||||
this._cursorUnfocusInhibited = false;
|
this._cursorUnfocusInhibited = false;
|
||||||
|
|
||||||
// Set/destroyed by _startCloningMouse / _stopCloningMouse
|
// Set/destroyed by _startCloningMouse / _stopCloningMouse
|
||||||
this._cursorWatch = null;
|
|
||||||
this._cursorChangedConnection = null;
|
this._cursorChangedConnection = null;
|
||||||
this._cursorVisibilityChangedConnection = null;
|
this._cursorVisibilityChangedConnection = null;
|
||||||
this._cursorPositionInvalidatedConnection = null;
|
this._moveToTopTimeout = null;
|
||||||
|
this._redraw_timeline = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
|
|
@ -76,7 +77,6 @@ export class CursorManager {
|
||||||
} else {
|
} else {
|
||||||
this._cursorActor.add_actor(this._cursorSprite);
|
this._cursorActor.add_actor(this._cursorSprite);
|
||||||
}
|
}
|
||||||
this._cursorWatcher = PointerWatcher.getPointerWatcher();
|
|
||||||
this._cursorSeat = Clutter.get_default_backend().get_default_seat();
|
this._cursorSeat = Clutter.get_default_backend().get_default_seat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +98,6 @@ export class CursorManager {
|
||||||
this._cursorTrackerSetPointerVisibleBound = null;
|
this._cursorTrackerSetPointerVisibleBound = null;
|
||||||
this._cursorSprite = null;
|
this._cursorSprite = null;
|
||||||
this._cursorActor = null;
|
this._cursorActor = null;
|
||||||
this._cursorWatcher = null;
|
|
||||||
this._cursorSeat = null;
|
this._cursorSeat = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,23 +122,41 @@ export class CursorManager {
|
||||||
// prereqs: setup in _enableCloningMouse, _cursorWantedVisible is true
|
// prereqs: setup in _enableCloningMouse, _cursorWantedVisible is true
|
||||||
_startCloningMouse() {
|
_startCloningMouse() {
|
||||||
Globals.logger.log_debug('CursorManager _startCloningMouse');
|
Globals.logger.log_debug('CursorManager _startCloningMouse');
|
||||||
if (this._cursorWatch == null) {
|
if (Clutter.Container === undefined) {
|
||||||
if (Clutter.Container === undefined) {
|
this._mainActor.add_child(this._cursorActor);
|
||||||
this._mainActor.add_child(this._cursorActor);
|
} else {
|
||||||
} else {
|
this._mainActor.add_actor(this._cursorActor);
|
||||||
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 / 250;
|
|
||||||
this._cursorWatch = this._cursorWatcher.addWatch(interval, this._updateMousePosition.bind(this));
|
|
||||||
|
|
||||||
const [x, y] = global.get_pointer();
|
|
||||||
this._updateMousePosition(x, y);
|
|
||||||
this._updateMouseSprite();
|
|
||||||
}
|
}
|
||||||
|
this._cursorChangedConnection = this._cursorTracker.connect('cursor-changed', this._updateMouseSprite.bind(this));
|
||||||
|
this._cursorVisibilityChangedConnection = this._cursorTracker.connect('visibility-changed', this._handleVisibilityChanged.bind(this));
|
||||||
|
|
||||||
|
// Some elements will occasionally appear above the cursor, so we periodically reset the actor stacking.
|
||||||
|
// This could theoretically be fixed "better" by attaching to all events that might affect actor ordering,
|
||||||
|
// but finding a comprehensive list is difficult and not future proof. So this ugly solution helps us
|
||||||
|
// catch everything.
|
||||||
|
this._moveToTopTimeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, (() => {
|
||||||
|
this._moveToTop()
|
||||||
|
return GLib.SOURCE_CONTINUE;
|
||||||
|
}).bind(this));
|
||||||
|
|
||||||
|
const refreshInterval = 1000 / this._refreshRate;
|
||||||
|
|
||||||
|
// we'll force repaint the cursor every frame,
|
||||||
|
// this keeps the cursor up-to-date and is sort of a hack that's a critical part of making sure
|
||||||
|
// the XR Effect refreshes even if nothing on-screen has changed (bypass the texture caching)
|
||||||
|
this._redraw_timeline = Clutter.Timeline.new_for_actor(this._cursorActor, refreshInterval);
|
||||||
|
this._redraw_timeline.set_repeat_count(-1);
|
||||||
|
|
||||||
|
var on = false;
|
||||||
|
this._redraw_timeline.connect('completed', (() => {
|
||||||
|
this._cursorActor.set_opacity(this._cursorActor.opacity + (on ? 1 : -1));
|
||||||
|
const [x, y] = global.get_pointer();
|
||||||
|
this._cursorActor.set_position(x, y);
|
||||||
|
on = !on;
|
||||||
|
}).bind(this));
|
||||||
|
this._redraw_timeline.start();
|
||||||
|
|
||||||
|
this._updateMouseSprite();
|
||||||
|
|
||||||
if (this._cursorTracker.set_keep_focus_while_hidden) {
|
if (this._cursorTracker.set_keep_focus_while_hidden) {
|
||||||
this._cursorTracker.set_keep_focus_while_hidden(true);
|
this._cursorTracker.set_keep_focus_while_hidden(true);
|
||||||
|
|
@ -160,28 +177,30 @@ export class CursorManager {
|
||||||
// completely reverts _startCloningMouse
|
// completely reverts _startCloningMouse
|
||||||
_stopCloningMouse() {
|
_stopCloningMouse() {
|
||||||
Globals.logger.log_debug('CursorManager _stopCloningMouse');
|
Globals.logger.log_debug('CursorManager _stopCloningMouse');
|
||||||
if (this._cursorWatch != null) {
|
if (this._cursorChangedConnection) {
|
||||||
this._cursorWatch.remove();
|
|
||||||
this._cursorWatch = null;
|
|
||||||
|
|
||||||
this._cursorTracker.disconnect(this._cursorChangedConnection);
|
this._cursorTracker.disconnect(this._cursorChangedConnection);
|
||||||
this._cursorChangedConnection = null;
|
this._cursorChangedConnection = null;
|
||||||
|
|
||||||
this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection);
|
|
||||||
this._cursorVisibilityChangedConnection = null;
|
|
||||||
|
|
||||||
this._cursorTracker.disconnect(this._cursorPositionInvalidatedConnection);
|
|
||||||
this._cursorPositionInvalidatedConnection = null;
|
|
||||||
|
|
||||||
if (Clutter.Container === undefined) {
|
|
||||||
this._mainActor.remove_child(this._cursorActor);
|
|
||||||
} else {
|
|
||||||
this._mainActor.remove_actor(this._cursorActor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._cursorTracker.set_keep_focus_while_hidden) {
|
if (this._cursorVisibilityChangedConnection) {
|
||||||
this._cursorTracker.set_keep_focus_while_hidden(false);
|
this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection);
|
||||||
|
this._cursorVisibilityChangedConnection = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Clutter.Container === undefined) {
|
||||||
|
this._mainActor.remove_child(this._cursorActor);
|
||||||
|
} else {
|
||||||
|
this._mainActor.remove_actor(this._cursorActor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._moveToTopTimeout) {
|
||||||
|
GLib.source_remove(this._moveToTopTimeout);
|
||||||
|
this._moveToTopTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._redraw_timeline) {
|
||||||
|
this._redraw_timeline.stop();
|
||||||
|
this._redraw_timeline = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._cursorUnfocusInhibited) {
|
if (this._cursorUnfocusInhibited) {
|
||||||
|
|
@ -191,10 +210,6 @@ export class CursorManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateMousePosition(x, y) {
|
|
||||||
this._cursorActor.set_position(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateMouseSprite() {
|
_updateMouseSprite() {
|
||||||
const sprite = this._cursorTracker.get_sprite();
|
const sprite = this._cursorTracker.get_sprite();
|
||||||
if (sprite) {
|
if (sprite) {
|
||||||
|
|
@ -209,8 +224,6 @@ export class CursorManager {
|
||||||
translation_x: -xHot,
|
translation_x: -xHot,
|
||||||
translation_y: -yHot,
|
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
|
// some other processes are uninhibiting when they shouldn't, so we need to re-inhibit here
|
||||||
if (!this._cursorSeat.is_unfocus_inhibited() && this._cursorUnfocusInhibited) {
|
if (!this._cursorSeat.is_unfocus_inhibited() && this._cursorUnfocusInhibited) {
|
||||||
|
|
@ -218,4 +231,12 @@ export class CursorManager {
|
||||||
this._cursorSeat.inhibit_unfocus();
|
this._cursorSeat.inhibit_unfocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_handleVisibilityChanged() {
|
||||||
|
this._cursorTrackerSetPointerVisibleBound(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
_moveToTop() {
|
||||||
|
this._mainActor.set_child_above_sibling(this._cursorActor, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,8 +40,12 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._distance_binding = null;
|
this._distance_binding = null;
|
||||||
this._distance_connection = null;
|
this._distance_connection = null;
|
||||||
this._follow_threshold_connection = null;
|
this._follow_threshold_connection = null;
|
||||||
|
this._widescreen_mode_settings_connection = null;
|
||||||
|
this._widescreen_mode_effect_state_connection = null;
|
||||||
this._start_binding = null;
|
this._start_binding = null;
|
||||||
this._end_binding = null;
|
this._end_binding = null;
|
||||||
|
this._curved_display_binding = null;
|
||||||
|
this._display_size_binding = null;
|
||||||
|
|
||||||
if (!Globals.logger) {
|
if (!Globals.logger) {
|
||||||
Globals.logger = new Logger({
|
Globals.logger = new Logger({
|
||||||
|
|
@ -65,7 +69,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
|
|
||||||
this._setup();
|
this._setup();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension enable ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension enable ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +113,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _find_supported_monitor ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _find_supported_monitor ${e.message}\n${e.stack}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +145,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
if (!Globals.ipc_file) Globals.ipc_file = Gio.file_new_for_path(IPC_FILE_PATH);
|
if (!Globals.ipc_file) Globals.ipc_file = Gio.file_new_for_path(IPC_FILE_PATH);
|
||||||
return Globals.ipc_file.query_exists(null);
|
return Globals.ipc_file.query_exists(null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _check_driver_running ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _check_driver_running ${e.message}\n${e.stack}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +157,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._is_effect_running = true;
|
this._is_effect_running = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup);
|
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup, this._refresh_rate * 1.05);
|
||||||
this._cursor_manager.enable();
|
this._cursor_manager.enable();
|
||||||
|
|
||||||
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);'});
|
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);'});
|
||||||
|
|
@ -184,14 +188,19 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
toggle_display_distance_end: this.settings.get_double('toggle-display-distance-end'),
|
toggle_display_distance_end: this.settings.get_double('toggle-display-distance-end'),
|
||||||
});
|
});
|
||||||
|
|
||||||
this._update_display_distance(this.settings);
|
|
||||||
this._update_follow_threshold(this.settings);
|
this._update_follow_threshold(this.settings);
|
||||||
|
this._update_widescreen_mode_from_settings(this.settings);
|
||||||
|
|
||||||
|
this._widescreen_mode_effect_state_connection = this._xr_effect.connect('notify::widescreen-mode-state', this._update_widescreen_mode_from_state.bind(this));
|
||||||
|
|
||||||
this._distance_binding = this.settings.bind('display-distance', this._xr_effect, 'display-distance', Gio.SettingsBindFlags.DEFAULT)
|
this._distance_binding = this.settings.bind('display-distance', this._xr_effect, 'display-distance', Gio.SettingsBindFlags.DEFAULT)
|
||||||
this._distance_connection = this.settings.connect('changed::display-distance', this._update_display_distance.bind(this))
|
this._distance_connection = this.settings.connect('changed::display-distance', this._update_display_distance.bind(this))
|
||||||
this._follow_threshold_connection = this.settings.connect('changed::follow-threshold', this._update_follow_threshold.bind(this))
|
this._follow_threshold_connection = this.settings.connect('changed::follow-threshold', this._update_follow_threshold.bind(this))
|
||||||
|
this._widescreen_mode_settings_connection = this.settings.connect('changed::widescreen-mode', this._update_widescreen_mode_from_settings.bind(this))
|
||||||
this._start_binding = this.settings.bind('toggle-display-distance-start', this._xr_effect, 'toggle-display-distance-start', Gio.SettingsBindFlags.DEFAULT)
|
this._start_binding = this.settings.bind('toggle-display-distance-start', this._xr_effect, 'toggle-display-distance-start', Gio.SettingsBindFlags.DEFAULT)
|
||||||
this._end_binding = this.settings.bind('toggle-display-distance-end', this._xr_effect, 'toggle-display-distance-end', Gio.SettingsBindFlags.DEFAULT)
|
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);
|
||||||
|
|
||||||
this._overlay.add_effect_with_name('xr-desktop', this._xr_effect);
|
this._overlay.add_effect_with_name('xr-desktop', this._xr_effect);
|
||||||
Meta.disable_unredirect_for_display(global.display);
|
Meta.disable_unredirect_for_display(global.display);
|
||||||
|
|
@ -200,7 +209,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._add_settings_keybinding('toggle-display-distance-shortcut', this._xr_effect._change_distance.bind(this._xr_effect));
|
this._add_settings_keybinding('toggle-display-distance-shortcut', this._xr_effect._change_distance.bind(this._xr_effect));
|
||||||
this._add_settings_keybinding('toggle-follow-shortcut', this._toggle_follow_mode.bind(this));
|
this._add_settings_keybinding('toggle-follow-shortcut', this._toggle_follow_mode.bind(this));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _effect_enable ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _effect_enable ${e.message}\n${e.stack}`);
|
||||||
this._effect_disable();
|
this._effect_disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -231,11 +240,11 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
bind_to_function
|
bind_to_function
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _add_settings_keybinding settings binding lambda ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _add_settings_keybinding settings binding lambda ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _add_settings_keybinding ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _add_settings_keybinding ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,6 +267,24 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
if (value !== undefined) this._write_control('breezy_desktop_follow_threshold', value);
|
if (value !== undefined) this._write_control('breezy_desktop_follow_threshold', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_update_widescreen_mode_from_settings(settings, event) {
|
||||||
|
const value = settings.get_boolean('widescreen-mode');
|
||||||
|
Globals.logger.log_debug(`BreezyDesktopExtension _update_widescreen_mode_from_settings ${value}`);
|
||||||
|
if (value !== undefined && value != this._xr_effect.widescreen_mode_state)
|
||||||
|
this._write_control('sbs_mode', value ? 'enable' : 'disable');
|
||||||
|
else
|
||||||
|
Globals.logger.log_debug('effect.widescreen_mode_state already matched setting');
|
||||||
|
}
|
||||||
|
|
||||||
|
_update_widescreen_mode_from_state(effect, _pspec) {
|
||||||
|
const value = effect.widescreen_mode_state;
|
||||||
|
Globals.logger.log_debug(`BreezyDesktopExtension _update_widescreen_mode_from_state ${value}`);
|
||||||
|
if (value !== this.settings.get_boolean('widescreen-mode'))
|
||||||
|
this.settings.set_boolean('widescreen-mode', value);
|
||||||
|
else
|
||||||
|
Globals.logger.log_debug('settings.widescreen-mode already matched state');
|
||||||
|
}
|
||||||
|
|
||||||
_recenter_display() {
|
_recenter_display() {
|
||||||
Globals.logger.log_debug('BreezyDesktopExtension _recenter_display');
|
Globals.logger.log_debug('BreezyDesktopExtension _recenter_display');
|
||||||
this._write_control('recenter_screen', 'true');
|
this._write_control('recenter_screen', 'true');
|
||||||
|
|
@ -299,6 +326,10 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this.settings.disconnect(this._follow_threshold_connection);
|
this.settings.disconnect(this._follow_threshold_connection);
|
||||||
this._follow_threshold_connection = null;
|
this._follow_threshold_connection = null;
|
||||||
}
|
}
|
||||||
|
if (this._widescreen_mode_settings_connection) {
|
||||||
|
this.settings.disconnect(this._widescreen_mode_settings_connection);
|
||||||
|
this._widescreen_mode_settings_connection = null;
|
||||||
|
}
|
||||||
if (this._start_binding) {
|
if (this._start_binding) {
|
||||||
this.settings.unbind(this._start_binding);
|
this.settings.unbind(this._start_binding);
|
||||||
this._start_binding = null;
|
this._start_binding = null;
|
||||||
|
|
@ -307,7 +338,19 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this.settings.unbind(this._end_binding);
|
this.settings.unbind(this._end_binding);
|
||||||
this._end_binding = null;
|
this._end_binding = null;
|
||||||
}
|
}
|
||||||
|
if (this._curved_display_binding) {
|
||||||
|
this.settings.unbind(this._curved_display_binding);
|
||||||
|
this._curved_display_binding = null;
|
||||||
|
}
|
||||||
|
if (this._display_size_binding) {
|
||||||
|
this.settings.unbind(this._display_size_binding);
|
||||||
|
this._display_size_binding = null;
|
||||||
|
}
|
||||||
if (this._xr_effect) {
|
if (this._xr_effect) {
|
||||||
|
if (this._widescreen_mode_effect_state_connection) {
|
||||||
|
this._xr_effect.disconnect(this._widescreen_mode_effect_state_connection);
|
||||||
|
this._widescreen_mode_effect_state_connection = null;
|
||||||
|
}
|
||||||
this._xr_effect.cleanup();
|
this._xr_effect.cleanup();
|
||||||
this._xr_effect = null;
|
this._xr_effect = null;
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +360,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._cursor_manager = null;
|
this._cursor_manager = null;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension _effect_disable ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension _effect_disable ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,7 +374,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._monitor_manager = null;
|
this._monitor_manager = null;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`ERROR: BreezyDesktopExtension disable ${e.message}`, e.stack);
|
Globals.logger.log(`ERROR: BreezyDesktopExtension disable ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export function dataViewBigUint(dataView, dataViewInfo) {
|
||||||
return Number(dataView.getBigUint64(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true));
|
return Number(dataView.getBigUint64(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dataViewUintArray(dataView, dataViewInfo) {
|
export function dataViewUint32Array(dataView, dataViewInfo) {
|
||||||
const uintArray = []
|
const uintArray = []
|
||||||
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
|
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
|
||||||
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
|
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
|
||||||
|
|
@ -34,6 +34,16 @@ export function dataViewUintArray(dataView, dataViewInfo) {
|
||||||
return uintArray;
|
return uintArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dataViewUint8Array(dataView, dataViewInfo) {
|
||||||
|
const uintArray = []
|
||||||
|
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
|
||||||
|
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_SIZE_INDEX] * dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
|
||||||
|
uintArray.push(dataView.getUint8(offset));
|
||||||
|
offset += UINT8_SIZE;
|
||||||
|
}
|
||||||
|
return uintArray;
|
||||||
|
}
|
||||||
|
|
||||||
export function dataViewFloat(dataView, dataViewInfo) {
|
export function dataViewFloat(dataView, dataViewInfo) {
|
||||||
return dataView.getFloat32(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true);
|
return dataView.getFloat32(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import {
|
||||||
dataViewEnd,
|
dataViewEnd,
|
||||||
dataViewUint8,
|
dataViewUint8,
|
||||||
dataViewBigUint,
|
dataViewBigUint,
|
||||||
dataViewUintArray,
|
dataViewUint32Array,
|
||||||
|
dataViewUint8Array,
|
||||||
dataViewFloat,
|
dataViewFloat,
|
||||||
dataViewFloatArray,
|
dataViewFloatArray,
|
||||||
BOOL_SIZE,
|
BOOL_SIZE,
|
||||||
|
|
@ -28,7 +29,7 @@ import { toSec } from "./time.js";
|
||||||
export const IPC_FILE_PATH = "/dev/shm/breezy_desktop_imu";
|
export const IPC_FILE_PATH = "/dev/shm/breezy_desktop_imu";
|
||||||
|
|
||||||
// the driver should be using the same data layout version
|
// the driver should be using the same data layout version
|
||||||
const DATA_LAYOUT_VERSION = 2;
|
const DATA_LAYOUT_VERSION = 3;
|
||||||
|
|
||||||
// DataView info: [offset, size, count]
|
// DataView info: [offset, size, count]
|
||||||
const VERSION = [0, UINT8_SIZE, 1];
|
const VERSION = [0, UINT8_SIZE, 1];
|
||||||
|
|
@ -41,7 +42,8 @@ const SBS_ENABLED = [dataViewEnd(LENS_DISTANCE_RATIO), BOOL_SIZE, 1];
|
||||||
const CUSTOM_BANNER_ENABLED = [dataViewEnd(SBS_ENABLED), BOOL_SIZE, 1];
|
const CUSTOM_BANNER_ENABLED = [dataViewEnd(SBS_ENABLED), BOOL_SIZE, 1];
|
||||||
const EPOCH_MS = [dataViewEnd(CUSTOM_BANNER_ENABLED), UINT_SIZE, 2];
|
const EPOCH_MS = [dataViewEnd(CUSTOM_BANNER_ENABLED), UINT_SIZE, 2];
|
||||||
const IMU_QUAT_DATA = [dataViewEnd(EPOCH_MS), FLOAT_SIZE, 16];
|
const IMU_QUAT_DATA = [dataViewEnd(EPOCH_MS), FLOAT_SIZE, 16];
|
||||||
const DATA_VIEW_LENGTH = dataViewEnd(IMU_QUAT_DATA);
|
const IMU_PARITY_BYTE = [dataViewEnd(IMU_QUAT_DATA), UINT8_SIZE, 1];
|
||||||
|
const DATA_VIEW_LENGTH = dataViewEnd(IMU_PARITY_BYTE);
|
||||||
|
|
||||||
// cached after first retrieval
|
// cached after first retrieval
|
||||||
const shaderUniformLocations = {
|
const shaderUniformLocations = {
|
||||||
|
|
@ -50,20 +52,20 @@ const shaderUniformLocations = {
|
||||||
'imu_quat_data': null,
|
'imu_quat_data': null,
|
||||||
'look_ahead_cfg': null,
|
'look_ahead_cfg': null,
|
||||||
'look_ahead_ms': null,
|
'look_ahead_ms': null,
|
||||||
'stage_aspect_ratio': null,
|
|
||||||
'display_aspect_ratio': null,
|
|
||||||
'trim_width_percent': null,
|
'trim_width_percent': null,
|
||||||
'trim_height_percent': null,
|
'trim_height_percent': null,
|
||||||
'display_zoom': null,
|
'display_size': null,
|
||||||
'display_north_offset': null,
|
'display_north_offset': null,
|
||||||
'lens_distance_ratio': null,
|
'lens_distance_ratio': null,
|
||||||
'sbs_enabled': null,
|
'sbs_enabled': null,
|
||||||
'sbs_content': null,
|
'sbs_content': null,
|
||||||
|
'sbs_mode_stretched': null,
|
||||||
'custom_banner_enabled': null,
|
'custom_banner_enabled': null,
|
||||||
'half_fov_z_rads': null,
|
'half_fov_z_rads': null,
|
||||||
'half_fov_y_rads': null,
|
'half_fov_y_rads': null,
|
||||||
'screen_distance': null,
|
'source_resolution': null,
|
||||||
'display_res': null
|
'display_resolution': null,
|
||||||
|
'curved_display': null
|
||||||
};
|
};
|
||||||
|
|
||||||
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
||||||
|
|
@ -119,22 +121,19 @@ function setIntermittentUniformVariables() {
|
||||||
const imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
const imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
||||||
const imuResetState = validKeepalive && imuData[0] === 0.0 && imuData[1] === 0.0 && imuData[2] === 0.0 && imuData[3] === 1.0;
|
const imuResetState = validKeepalive && imuData[0] === 0.0 && imuData[1] === 0.0 && imuData[2] === 0.0 && imuData[3] === 1.0;
|
||||||
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
||||||
|
const displayRes = dataViewUint32Array(dataView, DISPLAY_RES);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
|
||||||
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
||||||
const lensDistanceRatio = dataViewFloat(dataView, LENS_DISTANCE_RATIO);
|
|
||||||
|
|
||||||
// compute these values once, they only change when the XR device changes
|
// compute these values once, they only change when the XR device changes
|
||||||
const displayAspectRatio = displayRes[0] / displayRes[1];
|
const displayAspectRatio = displayRes[0] / displayRes[1];
|
||||||
const stageAspectRatio = this.target_monitor.width / this.target_monitor.height;
|
const diagToVertRatio = Math.sqrt(Math.pow(displayAspectRatio, 2) + 1);
|
||||||
const diagToVertRatio = Math.sqrt(Math.pow(stageAspectRatio, 2) + 1);
|
|
||||||
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
||||||
const halfFovYRads = halfFovZRads * stageAspectRatio;
|
const halfFovYRads = halfFovZRads * displayAspectRatio;
|
||||||
const screenDistance = 1.0 - lensDistanceRatio;
|
|
||||||
|
|
||||||
// our overlay doesn't quite cover the full screen texture, which allows us to see some of the real desktop
|
// our overlay doesn't quite cover the full screen texture, which allows us to see some of the real desktop
|
||||||
// underneath, so we trim two pixels around the entire edge of the texture
|
// underneath, so we trim three pixels around the entire edge of the texture
|
||||||
const trimWidthPercent = 3.0 / this.target_monitor.width;
|
const trimWidthPercent = 3.0 / this.target_monitor.width;
|
||||||
const trimHeightPercent = 3.0 / this.target_monitor.height;
|
const trimHeightPercent = 3.0 / this.target_monitor.height;
|
||||||
|
|
||||||
|
|
@ -143,31 +142,46 @@ function setIntermittentUniformVariables() {
|
||||||
transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO);
|
transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO);
|
||||||
|
|
||||||
// computed values with no dataViewInfo, so we set these manually
|
// computed values with no dataViewInfo, so we set these manually
|
||||||
setSingleFloat(this, 'stage_aspect_ratio', stageAspectRatio);
|
|
||||||
setSingleFloat(this, 'display_aspect_ratio', displayAspectRatio);
|
|
||||||
setSingleFloat(this, 'trim_width_percent', trimWidthPercent);
|
setSingleFloat(this, 'trim_width_percent', trimWidthPercent);
|
||||||
setSingleFloat(this, 'trim_height_percent', trimHeightPercent);
|
setSingleFloat(this, 'trim_height_percent', trimHeightPercent);
|
||||||
setSingleFloat(this, 'half_fov_z_rads', halfFovZRads);
|
setSingleFloat(this, 'half_fov_z_rads', halfFovZRads);
|
||||||
setSingleFloat(this, 'half_fov_y_rads', halfFovYRads);
|
setSingleFloat(this, 'half_fov_y_rads', halfFovYRads);
|
||||||
setSingleFloat(this, 'screen_distance', screenDistance);
|
setSingleFloat(this, 'curved_display', this.curved_display ? 1.0 : 0.0);
|
||||||
|
|
||||||
// TOOD - drive from settings
|
|
||||||
setSingleFloat(this, 'display_zoom', 1.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the widescreen property if the state changes, so notify events are triggered
|
||||||
|
const sbsEnabled = dataViewUint8(dataView, SBS_ENABLED) !== 0;
|
||||||
|
if (this.widescreen_mode_state !== sbsEnabled) this.widescreen_mode_state = sbsEnabled;
|
||||||
|
|
||||||
// these variables are always in play, even if enabled is false
|
// these variables are always in play, even if enabled is false
|
||||||
setSingleFloat(this, 'enabled', enabled ? 1.0 : 0.0);
|
setSingleFloat(this, 'enabled', enabled ? 1.0 : 0.0);
|
||||||
setSingleFloat(this, 'show_banner', imuResetState ? 1.0 : 0.0);
|
setSingleFloat(this, 'show_banner', imuResetState ? 1.0 : 0.0);
|
||||||
setSingleFloat(this, 'sbs_content', 0.0); // TOOD - drive from settings
|
setSingleFloat(this, 'sbs_content', 0.0); // TODO - drive from settings
|
||||||
setSingleFloat(this, 'sbs_enabled', dataViewUint8(dataView, SBS_ENABLED) !== 0 ? 1.0 : 0.0);
|
setSingleFloat(this, 'sbs_mode_stretched', 1.0); // content always fills the whole display
|
||||||
|
setSingleFloat(this, 'sbs_enabled', sbsEnabled ? 1.0 : 0.0);
|
||||||
setSingleFloat(this, 'custom_banner_enabled', dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0 ? 1.0 : 0.0);
|
setSingleFloat(this, 'custom_banner_enabled', dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0 ? 1.0 : 0.0);
|
||||||
|
|
||||||
this.set_uniform_float(shaderUniformLocations['display_res'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
this.set_uniform_float(shaderUniformLocations['display_resolution'], 2, displayRes);
|
||||||
|
this.set_uniform_float(shaderUniformLocations['source_resolution'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
||||||
} else if (dataView.byteLength !== 0) {
|
} else if (dataView.byteLength !== 0) {
|
||||||
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkParityByte(dataView) {
|
||||||
|
const parityByte = dataViewUint8(dataView, IMU_PARITY_BYTE);
|
||||||
|
let parity = 0;
|
||||||
|
const epochUint8 = dataViewUint8Array(dataView, EPOCH_MS);
|
||||||
|
const imuDataUint8 = dataViewUint8Array(dataView, IMU_QUAT_DATA);
|
||||||
|
for (let i = 0; i < epochUint8.length; i++) {
|
||||||
|
parity ^= epochUint8[i];
|
||||||
|
}
|
||||||
|
for (let i = 0; i < imuDataUint8.length; i++) {
|
||||||
|
parity ^= imuDataUint8[i];
|
||||||
|
}
|
||||||
|
return parityByte === parity;
|
||||||
|
}
|
||||||
|
|
||||||
export const XREffect = GObject.registerClass({
|
export const XREffect = GObject.registerClass({
|
||||||
Properties: {
|
Properties: {
|
||||||
'target-monitor': GObject.ParamSpec.jsobject(
|
'target-monitor': GObject.ParamSpec.jsobject(
|
||||||
|
|
@ -208,13 +222,38 @@ export const XREffect = GObject.registerClass({
|
||||||
0.2,
|
0.2,
|
||||||
2.5,
|
2.5,
|
||||||
1.05
|
1.05
|
||||||
|
),
|
||||||
|
'curved-display': GObject.ParamSpec.boolean(
|
||||||
|
'curved-display',
|
||||||
|
'Curved Display',
|
||||||
|
'Whether the display is curved',
|
||||||
|
GObject.ParamFlags.READWRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
'widescreen-mode-state': GObject.ParamSpec.boolean(
|
||||||
|
'widescreen-mode-state',
|
||||||
|
'Widescreen mode state',
|
||||||
|
'The state of widescreen mode from the perspective of the driver',
|
||||||
|
GObject.ParamFlags.READWRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
'widescreen-display-size': GObject.ParamSpec.double(
|
||||||
|
'widescreen-display-size',
|
||||||
|
'Widescreen display size',
|
||||||
|
'Size of the display when in widescreen/SBS mode',
|
||||||
|
GObject.ParamFlags.READWRITE,
|
||||||
|
0.2,
|
||||||
|
2.5,
|
||||||
|
1.0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, class XREffect extends Shell.GLSLEffect {
|
}, class XREffect extends Shell.GLSLEffect {
|
||||||
constructor(params = {}) {
|
constructor(params = {}) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
this._frametime = Math.floor(1000 / this.target_framerate);
|
// target a slightly lower framerate than the monitor's refresh rate to prevent repainting too frequently
|
||||||
|
const frameTimeFramerate = this.target_framerate * 0.9;
|
||||||
|
this._frametime = Math.floor(1000 / frameTimeFramerate);
|
||||||
|
|
||||||
this._is_display_distance_at_end = false;
|
this._is_display_distance_at_end = false;
|
||||||
this._distance_ease_timeline = null;
|
this._distance_ease_timeline = null;
|
||||||
|
|
@ -255,14 +294,12 @@ export const XREffect = GObject.registerClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_paint_target(node, paintContext) {
|
vfunc_paint_target(node, paintContext) {
|
||||||
var now = Date.now();
|
|
||||||
var lastPaint = this._last_paint || 0;
|
|
||||||
var frametime = this._frametime;
|
var frametime = this._frametime;
|
||||||
var calibratingImage = this.calibratingImage;
|
var calibratingImage = this.calibratingImage;
|
||||||
var customBannerImage = this.customBannerImage;
|
var customBannerImage = this.customBannerImage;
|
||||||
const data = Globals.ipc_file.load_contents(null);
|
let data = Globals.ipc_file.load_contents(null);
|
||||||
if (data[0]) {
|
if (data[0]) {
|
||||||
const buffer = new Uint8Array(data[1]).buffer;
|
let buffer = new Uint8Array(data[1]).buffer;
|
||||||
this._dataView = new DataView(buffer);
|
this._dataView = new DataView(buffer);
|
||||||
if (!this._initialized) {
|
if (!this._initialized) {
|
||||||
this.set_uniform_float(this.get_uniform_location('uDesktopTexture'), 1, [0]);
|
this.set_uniform_float(this.get_uniform_location('uDesktopTexture'), 1, [0]);
|
||||||
|
|
@ -278,11 +315,6 @@ export const XREffect = GObject.registerClass({
|
||||||
this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this);
|
this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this);
|
||||||
this.setIntermittentUniformVariables();
|
this.setIntermittentUniformVariables();
|
||||||
|
|
||||||
this._redraw_timeout_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._frametime, () => {
|
|
||||||
if ((now - lastPaint) > frametime) global.stage.queue_redraw();
|
|
||||||
return GLib.SOURCE_CONTINUE;
|
|
||||||
});
|
|
||||||
|
|
||||||
this._uniforms_timeout_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 250, (() => {
|
this._uniforms_timeout_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 250, (() => {
|
||||||
this.setIntermittentUniformVariables();
|
this.setIntermittentUniformVariables();
|
||||||
return GLib.SOURCE_CONTINUE;
|
return GLib.SOURCE_CONTINUE;
|
||||||
|
|
@ -291,12 +323,28 @@ export const XREffect = GObject.registerClass({
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._dataView.byteLength === DATA_VIEW_LENGTH) {
|
let success = false;
|
||||||
setSingleFloat(this, 'display_north_offset', this.display_distance);
|
let attempts = 0;
|
||||||
setSingleFloat(this, 'look_ahead_ms', lookAheadMS(this._dataView));
|
while (!success && attempts < 2) {
|
||||||
setUniformMatrix(this, 'imu_quat_data', 4, this._dataView, IMU_QUAT_DATA);
|
if (this._dataView.byteLength === DATA_VIEW_LENGTH) {
|
||||||
} else if (this._dataView.byteLength !== 0) {
|
if (checkParityByte(this._dataView)) {
|
||||||
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${this._dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
setSingleFloat(this, 'display_north_offset', this.display_distance);
|
||||||
|
setSingleFloat(this, 'look_ahead_ms', lookAheadMS(this._dataView));
|
||||||
|
setUniformMatrix(this, 'imu_quat_data', 4, this._dataView, IMU_QUAT_DATA);
|
||||||
|
setSingleFloat(this, 'display_size', this.widescreen_mode_state ? this.widescreen_display_size : 1.0);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
} else if (this._dataView.byteLength !== 0) {
|
||||||
|
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${this._dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success && ++attempts < 3) {
|
||||||
|
data = Globals.ipc_file.load_contents(null);
|
||||||
|
if (data[0]) {
|
||||||
|
buffer = new Uint8Array(data[1]).buffer;
|
||||||
|
this._dataView = new DataView(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// improves sampling quality for smooth text and edges
|
// improves sampling quality for smooth text and edges
|
||||||
|
|
@ -305,16 +353,11 @@ export const XREffect = GObject.registerClass({
|
||||||
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
|
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
|
||||||
Cogl.PipelineFilter.LINEAR
|
Cogl.PipelineFilter.LINEAR
|
||||||
);
|
);
|
||||||
|
|
||||||
super.vfunc_paint_target(node, paintContext);
|
|
||||||
} else {
|
|
||||||
super.vfunc_paint_target(node, paintContext);
|
|
||||||
}
|
}
|
||||||
this._last_paint = now;
|
super.vfunc_paint_target(node, paintContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if (this._redraw_timeout_id) GLib.source_remove(this._redraw_timeout_id);
|
|
||||||
if (this._uniforms_timeout_id) GLib.source_remove(this._uniforms_timeout_id);
|
if (this._uniforms_timeout_id) GLib.source_remove(this._uniforms_timeout_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit f45b8fbaa7ef0b3f824a3452a91dc74bffb6ea38
|
Subproject commit 6925472075303853db6fa08bad364768861f42b6
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 26ece497d36bbe2a7445ea2f4e1cce31c35daa3a
|
Subproject commit 7eea3e01b4cd03dc07fa03f3f5903e31fc8dffbc
|
||||||
|
|
@ -64,6 +64,33 @@
|
||||||
End distance when using the "toggle display distance" shortcut.
|
End distance when using the "toggle display distance" shortcut.
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="widescreen-mode" type="b">
|
||||||
|
<default>
|
||||||
|
false
|
||||||
|
</default>
|
||||||
|
<summary>Widescreen mode</summary>
|
||||||
|
<description>
|
||||||
|
Enable widescreen/SBS mode
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
<key name="widescreen-display-size" type="d">
|
||||||
|
<default>
|
||||||
|
1.0
|
||||||
|
</default>
|
||||||
|
<summary>Widescreen display size</summary>
|
||||||
|
<description>
|
||||||
|
The size of the display when in widescreen/SBS mode
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
<key name="curved-display" type="b">
|
||||||
|
<default>
|
||||||
|
false
|
||||||
|
</default>
|
||||||
|
<summary>Curved display</summary>
|
||||||
|
<description>
|
||||||
|
Enable curved display mode
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
<key name="developer-mode" type="b">
|
<key name="developer-mode" type="b">
|
||||||
<default>
|
<default>
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,21 @@ from .xrdriveripc import XRDriverIPC
|
||||||
class ConnectedDevice(Gtk.Box):
|
class ConnectedDevice(Gtk.Box):
|
||||||
__gtype_name__ = "ConnectedDevice"
|
__gtype_name__ = "ConnectedDevice"
|
||||||
|
|
||||||
|
device_label = Gtk.Template.Child()
|
||||||
effect_enable_switch = Gtk.Template.Child()
|
effect_enable_switch = Gtk.Template.Child()
|
||||||
|
display_distance_row = Gtk.Template.Child()
|
||||||
display_distance_scale = Gtk.Template.Child()
|
display_distance_scale = Gtk.Template.Child()
|
||||||
display_distance_adjustment = Gtk.Template.Child()
|
display_distance_adjustment = Gtk.Template.Child()
|
||||||
follow_threshold_scale = Gtk.Template.Child()
|
follow_threshold_scale = Gtk.Template.Child()
|
||||||
follow_threshold_adjustment = Gtk.Template.Child()
|
follow_threshold_adjustment = Gtk.Template.Child()
|
||||||
follow_mode_switch = Gtk.Template.Child()
|
follow_mode_switch = Gtk.Template.Child()
|
||||||
device_label = Gtk.Template.Child()
|
widescreen_mode_switch = Gtk.Template.Child()
|
||||||
|
widescreen_display_distance_row = Gtk.Template.Child()
|
||||||
|
widescreen_display_distance_scale = Gtk.Template.Child()
|
||||||
|
widescreen_display_distance_adjustment = Gtk.Template.Child()
|
||||||
|
widescreen_display_size_scale = Gtk.Template.Child()
|
||||||
|
widescreen_display_size_adjustment = Gtk.Template.Child()
|
||||||
|
curved_display_switch = Gtk.Template.Child()
|
||||||
set_toggle_display_distance_start_button = Gtk.Template.Child()
|
set_toggle_display_distance_start_button = Gtk.Template.Child()
|
||||||
set_toggle_display_distance_end_button = Gtk.Template.Child()
|
set_toggle_display_distance_end_button = Gtk.Template.Child()
|
||||||
reassign_recenter_display_shortcut_button = Gtk.Template.Child()
|
reassign_recenter_display_shortcut_button = Gtk.Template.Child()
|
||||||
|
|
@ -33,6 +41,10 @@ class ConnectedDevice(Gtk.Box):
|
||||||
self.display_distance_scale,
|
self.display_distance_scale,
|
||||||
self.follow_mode_switch,
|
self.follow_mode_switch,
|
||||||
self.follow_threshold_scale,
|
self.follow_threshold_scale,
|
||||||
|
self.widescreen_mode_switch,
|
||||||
|
self.widescreen_display_distance_scale,
|
||||||
|
self.widescreen_display_size_scale,
|
||||||
|
self.curved_display_switch,
|
||||||
self.set_toggle_display_distance_start_button,
|
self.set_toggle_display_distance_start_button,
|
||||||
self.set_toggle_display_distance_end_button,
|
self.set_toggle_display_distance_end_button,
|
||||||
self.reassign_recenter_display_shortcut_button,
|
self.reassign_recenter_display_shortcut_button,
|
||||||
|
|
@ -45,7 +57,11 @@ class ConnectedDevice(Gtk.Box):
|
||||||
self.extensions_manager = ExtensionsManager.get_instance()
|
self.extensions_manager = ExtensionsManager.get_instance()
|
||||||
|
|
||||||
self.settings.bind('display-distance', self.display_distance_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
self.settings.bind('display-distance', self.display_distance_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
||||||
|
self.settings.bind('display-distance', self.widescreen_display_distance_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
||||||
self.settings.bind('follow-threshold', self.follow_threshold_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
self.settings.bind('follow-threshold', self.follow_threshold_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
||||||
|
self.settings.bind('widescreen-mode', self.widescreen_mode_switch, 'active', Gio.SettingsBindFlags.DEFAULT)
|
||||||
|
self.settings.bind('widescreen-display-size', self.widescreen_display_size_adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
|
||||||
|
self.settings.bind('curved-display', self.curved_display_switch, 'active', Gio.SettingsBindFlags.DEFAULT)
|
||||||
|
|
||||||
bind_shortcut_settings(self.get_parent(), [
|
bind_shortcut_settings(self.get_parent(), [
|
||||||
[self.reassign_recenter_display_shortcut_button, self.recenter_display_shortcut_label],
|
[self.reassign_recenter_display_shortcut_button, self.recenter_display_shortcut_label],
|
||||||
|
|
@ -65,6 +81,8 @@ class ConnectedDevice(Gtk.Box):
|
||||||
self.follow_mode_switch.set_active(self.state_manager.follow_mode)
|
self.follow_mode_switch.set_active(self.state_manager.follow_mode)
|
||||||
self.follow_mode_switch.connect('notify::active', self._refresh_follow_mode)
|
self.follow_mode_switch.connect('notify::active', self._refresh_follow_mode)
|
||||||
|
|
||||||
|
self.widescreen_mode_switch.connect('notify::active', self._refresh_widescreen_mode)
|
||||||
|
|
||||||
self.effect_enable_switch.set_active(self._is_config_enabled(self.ipc.retrieve_config()) and self.extensions_manager.is_enabled())
|
self.effect_enable_switch.set_active(self._is_config_enabled(self.ipc.retrieve_config()) and self.extensions_manager.is_enabled())
|
||||||
self.effect_enable_switch.connect('notify::active', self._refresh_inputs_for_enabled_state)
|
self.effect_enable_switch.connect('notify::active', self._refresh_inputs_for_enabled_state)
|
||||||
|
|
||||||
|
|
@ -84,6 +102,14 @@ class ConnectedDevice(Gtk.Box):
|
||||||
def _is_config_enabled(self, config):
|
def _is_config_enabled(self, config):
|
||||||
return config.get('disabled') == False and 'breezy_desktop' in config.get('external_mode', [])
|
return config.get('disabled') == False and 'breezy_desktop' in config.get('external_mode', [])
|
||||||
|
|
||||||
|
def _refresh_widescreen_mode(self, switch, param):
|
||||||
|
widescreen_mode_enabled = switch.get_active()
|
||||||
|
self.widescreen_display_distance_row.set_visible(widescreen_mode_enabled)
|
||||||
|
self.display_distance_row.set_visible(not widescreen_mode_enabled)
|
||||||
|
for widget in [self.widescreen_display_distance_scale, self.widescreen_display_size_scale]:
|
||||||
|
widget.set_sensitive(widescreen_mode_enabled)
|
||||||
|
|
||||||
|
|
||||||
def _refresh_inputs_for_enabled_state(self, switch, param):
|
def _refresh_inputs_for_enabled_state(self, switch, param):
|
||||||
requesting_enabled = switch.get_active()
|
requesting_enabled = switch.get_active()
|
||||||
self.extensions_manager.set_property('breezy-enabled', requesting_enabled)
|
self.extensions_manager.set_property('breezy-enabled', requesting_enabled)
|
||||||
|
|
@ -98,7 +124,9 @@ class ConnectedDevice(Gtk.Box):
|
||||||
for widget in self.all_enabled_state_inputs:
|
for widget in self.all_enabled_state_inputs:
|
||||||
widget.set_sensitive(requesting_enabled)
|
widget.set_sensitive(requesting_enabled)
|
||||||
|
|
||||||
if requesting_enabled: self._refresh_follow_mode(self.follow_mode_switch, None)
|
if requesting_enabled:
|
||||||
|
self._refresh_follow_mode(self.follow_mode_switch, None)
|
||||||
|
self._refresh_widescreen_mode(self.widescreen_mode_switch, None)
|
||||||
|
|
||||||
def _refresh_follow_mode(self, switch, param):
|
def _refresh_follow_mode(self, switch, param):
|
||||||
self.follow_threshold_scale.set_sensitive(switch.get_active())
|
self.follow_threshold_scale.set_sensitive(switch.get_active())
|
||||||
|
|
@ -121,6 +149,7 @@ class ConnectedDevice(Gtk.Box):
|
||||||
self.state_manager.unbind_property('follow-mode', self.follow_mode_switch, 'active')
|
self.state_manager.unbind_property('follow-mode', self.follow_mode_switch, 'active')
|
||||||
self.settings.unbind('display-distance', self.display_distance_adjustment, 'value')
|
self.settings.unbind('display-distance', self.display_distance_adjustment, 'value')
|
||||||
self.settings.unbind('follow-threshold', self.follow_threshold_adjustment, 'value')
|
self.settings.unbind('follow-threshold', self.follow_threshold_adjustment, 'value')
|
||||||
|
self.settings.unbind('widescreen-mode', self.widescreen_mode_switch, 'active')
|
||||||
self.extensions_manager.unbind_property('breezy-enabled', self.effect_enable_switch, 'active')
|
self.extensions_manager.unbind_property('breezy-enabled', self.effect_enable_switch, 'active')
|
||||||
|
|
||||||
def reload_display_distance_toggle_button(widget):
|
def reload_display_distance_toggle_button(widget):
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwActionRow" id="display_distance_row">
|
||||||
<property name="title" translatable="true">Display distance</property>
|
<property name="title" translatable="true">Display distance</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScale" id="display_distance_scale">
|
<object class="GtkScale" id="display_distance_scale">
|
||||||
|
|
@ -100,6 +100,93 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwActionRow">
|
||||||
|
<property name="title" translatable="true">Curved display</property>
|
||||||
|
<property name="subtitle" translatable="true">Switch between flat and curved displays</property>
|
||||||
|
<property name="valign">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="curved_display_switch">
|
||||||
|
<property name="valign">3</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child><child>
|
||||||
|
<object class="AdwPreferencesGroup">
|
||||||
|
<property name="title" translatable="true">Widescreen</property>
|
||||||
|
<property name="description" translatable="true">Widescreen mode switches your glasses into side-by-side mode and doubles the width of the display</property>
|
||||||
|
<child>
|
||||||
|
<object class="AdwActionRow">
|
||||||
|
<property name="title" translatable="true">Enable widescreen</property>
|
||||||
|
<property name="subtitle" translatable="true">Switches your glasses into side-by-side mode</property>
|
||||||
|
<property name="valign">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="widescreen_mode_switch">
|
||||||
|
<property name="valign">3</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwActionRow" id="widescreen_display_distance_row">
|
||||||
|
<property name="title" translatable="true">Display distance</property>
|
||||||
|
<property name="subtitle" translatable="true">Move the screen closer or further using SBS depth</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="widescreen_display_distance_scale">
|
||||||
|
<property name="valign">3</property>
|
||||||
|
<property name="draw-value">true</property>
|
||||||
|
<property name="value-pos">0</property>
|
||||||
|
<property name="digits">2</property>
|
||||||
|
<property name="width-request">350</property>
|
||||||
|
<property name="has-origin">false</property>
|
||||||
|
<property name="adjustment">
|
||||||
|
<object class="GtkAdjustment" id="widescreen_display_distance_adjustment">
|
||||||
|
<property name="lower">0.2</property>
|
||||||
|
<property name="upper">2.5</property>
|
||||||
|
<property name="step-increment">0.01</property>
|
||||||
|
<property name="value">1.05</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<marks>
|
||||||
|
<mark value="0.2" position="bottom"></mark>
|
||||||
|
<mark value="1.0" position="bottom"></mark>
|
||||||
|
<mark value="2.5" position="bottom"></mark>
|
||||||
|
</marks>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwActionRow">
|
||||||
|
<property name="title" translatable="true">Display size</property>
|
||||||
|
<property name="subtitle" translatable="true">Combine with display distance to achieve a comfortable level of depth and size</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="widescreen_display_size_scale">
|
||||||
|
<property name="valign">3</property>
|
||||||
|
<property name="draw-value">true</property>
|
||||||
|
<property name="value-pos">0</property>
|
||||||
|
<property name="digits">2</property>
|
||||||
|
<property name="width-request">350</property>
|
||||||
|
<property name="has-origin">false</property>
|
||||||
|
<property name="adjustment">
|
||||||
|
<object class="GtkAdjustment" id="widescreen_display_size_adjustment">
|
||||||
|
<property name="lower">0.2</property>
|
||||||
|
<property name="upper">2.5</property>
|
||||||
|
<property name="step-increment">0.01</property>
|
||||||
|
<property name="value">1.0</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<marks>
|
||||||
|
<mark value="0.2" position="bottom"></mark>
|
||||||
|
<mark value="1.0" position="bottom"></mark>
|
||||||
|
<mark value="2.5" position="bottom"></mark>
|
||||||
|
</marks>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ class StateManager(GObject.GObject):
|
||||||
__gproperties__ = {
|
__gproperties__ = {
|
||||||
'follow-mode': (bool, 'Follow Mode', 'Whether the follow mode is enabled', False, GObject.ParamFlags.READWRITE),
|
'follow-mode': (bool, 'Follow Mode', 'Whether the follow mode is enabled', False, GObject.ParamFlags.READWRITE),
|
||||||
'follow-threshold': (float, 'Follow Threshold', 'The follow threshold', 1.0, 45.0, 15.0, GObject.ParamFlags.READWRITE),
|
'follow-threshold': (float, 'Follow Threshold', 'The follow threshold', 1.0, 45.0, 15.0, GObject.ParamFlags.READWRITE),
|
||||||
|
'widescreen-mode': (bool, 'Widescreen Mode', 'Whether widescreen mode is enabled', False, GObject.ParamFlags.READWRITE),
|
||||||
'license-action-needed': (bool, 'License Action Needed', 'Whether the license needs attention', False, GObject.ParamFlags.READWRITE),
|
'license-action-needed': (bool, 'License Action Needed', 'Whether the license needs attention', False, GObject.ParamFlags.READWRITE),
|
||||||
'license-present': (bool, 'License Present', 'Whether a license is present', False, GObject.ParamFlags.READWRITE),
|
'license-present': (bool, 'License Present', 'Whether a license is present', False, GObject.ParamFlags.READWRITE),
|
||||||
'enabled-features-list': (object, 'Enabled Features List', 'A list of the enabled features', GObject.ParamFlags.READWRITE),
|
'enabled-features-list': (object, 'Enabled Features List', 'A list of the enabled features', GObject.ParamFlags.READWRITE),
|
||||||
|
|
@ -94,12 +95,15 @@ class StateManager(GObject.GObject):
|
||||||
self.set_property('license-present', False)
|
self.set_property('license-present', False)
|
||||||
|
|
||||||
self.set_property('follow-mode', self.state.get('breezy_desktop_smooth_follow_enabled'))
|
self.set_property('follow-mode', self.state.get('breezy_desktop_smooth_follow_enabled'))
|
||||||
|
self.set_property('widescreen-mode', self.state.get('sbs_mode_enabled'))
|
||||||
|
|
||||||
if self.running: threading.Timer(1.0, self._refresh_state).start()
|
if self.running: threading.Timer(1.0, self._refresh_state).start()
|
||||||
|
|
||||||
def do_set_property(self, prop, value):
|
def do_set_property(self, prop, value):
|
||||||
if prop.name == 'follow-mode':
|
if prop.name == 'follow-mode':
|
||||||
self.follow_mode = value
|
self.follow_mode = value
|
||||||
|
if prop.name == 'widescreen-mode':
|
||||||
|
self.widescreen_mode = value
|
||||||
if prop.name == 'license-action-needed':
|
if prop.name == 'license-action-needed':
|
||||||
self.license_action_needed = value
|
self.license_action_needed = value
|
||||||
if prop.name == 'license-present':
|
if prop.name == 'license-present':
|
||||||
|
|
@ -110,6 +114,8 @@ class StateManager(GObject.GObject):
|
||||||
def do_get_property(self, prop):
|
def do_get_property(self, prop):
|
||||||
if prop.name == 'follow-mode':
|
if prop.name == 'follow-mode':
|
||||||
return self.follow_mode
|
return self.follow_mode
|
||||||
|
if prop.name == 'widescreen-mode':
|
||||||
|
return self.widescreen_mode
|
||||||
if prop.name == 'license-action-needed':
|
if prop.name == 'license-action-needed':
|
||||||
return self.license_action_needed
|
return self.license_action_needed
|
||||||
if prop.name == 'license-present':
|
if prop.name == 'license-present':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue