Add automatic recenter on effect start, fix banner case, update XRDriverIPC, fix how we write to the control flags file so it's atomic
This commit is contained in:
parent
9522654aa4
commit
e02dabdc2c
|
|
@ -11,3 +11,4 @@
|
||||||
[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
|
||||||
|
branch = v1.1
|
||||||
|
|
|
||||||
|
|
@ -177,11 +177,11 @@ export const DeviceDataStream = GObject.registerClass({
|
||||||
if (dataView.byteLength === DATA_VIEW_LENGTH) {
|
if (dataView.byteLength === DATA_VIEW_LENGTH) {
|
||||||
let imuDateMs = dataViewBigUint(dataView, EPOCH_MS);
|
let imuDateMs = dataViewBigUint(dataView, EPOCH_MS);
|
||||||
const validKeepalive = isValidKeepAlive(toSec(imuDateMs));
|
const validKeepalive = isValidKeepAlive(toSec(imuDateMs));
|
||||||
let 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 customBannerEnabled = dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0;
|
|
||||||
const version = dataViewUint8(dataView, VERSION);
|
const version = dataViewUint8(dataView, VERSION);
|
||||||
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
||||||
|
let imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
||||||
|
const imuResetState = enabled && validKeepalive && imuData[0] === 0.0 && imuData[1] === 0.0 && imuData[2] === 0.0 && imuData[3] === 1.0;
|
||||||
|
const customBannerEnabled = dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0;
|
||||||
const sbsEnabled = dataViewUint8(dataView, SBS_ENABLED) !== 0;
|
const sbsEnabled = dataViewUint8(dataView, SBS_ENABLED) !== 0;
|
||||||
|
|
||||||
// trigger "notify::" events for properties we want to check on every cycle
|
// trigger "notify::" events for properties we want to check on every cycle
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._is_effect_running = false;
|
this._is_effect_running = false;
|
||||||
this._distance_binding = null;
|
this._distance_binding = null;
|
||||||
this._show_banner_binding = null;
|
this._show_banner_binding = null;
|
||||||
|
this._show_banner_connection = null;
|
||||||
this._custom_banner_enabled_binding = null;
|
this._custom_banner_enabled_binding = null;
|
||||||
this._monitor_wrapping_scheme_binding = null;
|
this._monitor_wrapping_scheme_binding = null;
|
||||||
this._viewport_offset_x_binding = null;
|
this._viewport_offset_x_binding = null;
|
||||||
|
|
@ -253,7 +254,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._cursor_manager.enable();
|
this._cursor_manager.enable();
|
||||||
|
|
||||||
// use rgba(255, 4, 144, 1) for chroma key background
|
// use rgba(255, 4, 144, 1) for chroma key background
|
||||||
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);', reactive: false, clip_to_allocation: true });
|
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);', clip_to_allocation: true });
|
||||||
this._overlay.opacity = 255;
|
this._overlay.opacity = 255;
|
||||||
this._overlay.set_position(targetMonitor.x, targetMonitor.y);
|
this._overlay.set_position(targetMonitor.x, targetMonitor.y);
|
||||||
this._overlay.set_size(targetMonitor.width, targetMonitor.height);
|
this._overlay.set_size(targetMonitor.width, targetMonitor.height);
|
||||||
|
|
@ -275,8 +276,7 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
framerate_cap: this.settings.get_double('framerate-cap'),
|
framerate_cap: this.settings.get_double('framerate-cap'),
|
||||||
imu_snapshots: Globals.data_stream.imu_snapshots,
|
imu_snapshots: Globals.data_stream.imu_snapshots,
|
||||||
show_banner: Globals.data_stream.show_banner,
|
show_banner: Globals.data_stream.show_banner,
|
||||||
custom_banner_enabled: Globals.data_stream.custom_banner_enabled,
|
custom_banner_enabled: Globals.data_stream.custom_banner_enabled
|
||||||
reactive: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._overlay.set_child(this._overlay_content);
|
this._overlay.set_child(this._overlay_content);
|
||||||
|
|
@ -305,6 +305,11 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
// this._widescreen_mode_effect_state_connection = this._xr_effect.connect('notify::widescreen-mode-state', this._update_widescreen_mode_from_state.bind(this));
|
// this._widescreen_mode_effect_state_connection = this._xr_effect.connect('notify::widescreen-mode-state', this._update_widescreen_mode_from_state.bind(this));
|
||||||
|
|
||||||
this._show_banner_binding = Globals.data_stream.bind_property('show-banner', this._overlay_content, 'show-banner', Gio.SettingsBindFlags.DEFAULT);
|
this._show_banner_binding = Globals.data_stream.bind_property('show-banner', this._overlay_content, 'show-banner', Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
this._show_banner_connection = Globals.data_stream.connect('notify::show-banner', this._handle_show_banner_update.bind(this));
|
||||||
|
this._was_show_banner = Globals.data_stream.show_banner;
|
||||||
|
Globals.logger.log_debug(`BreezyDesktopExtension _effect_enable - show_banner: ${this._was_show_banner}`);
|
||||||
|
if (!this._was_show_banner) this._recenter_display();
|
||||||
|
|
||||||
this._custom_banner_enabled_binding = Globals.data_stream.bind_property('custom-banner-enabled', this._overlay_content, 'custom-banner-enabled', Gio.SettingsBindFlags.DEFAULT);
|
this._custom_banner_enabled_binding = Globals.data_stream.bind_property('custom-banner-enabled', this._overlay_content, 'custom-banner-enabled', Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
this._monitor_wrapping_scheme_binding = this.settings.bind('monitor-wrapping-scheme', this._overlay_content, 'monitor-wrapping-scheme', Gio.SettingsBindFlags.DEFAULT);
|
this._monitor_wrapping_scheme_binding = this.settings.bind('monitor-wrapping-scheme', this._overlay_content, 'monitor-wrapping-scheme', Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
@ -378,10 +383,15 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
|
|
||||||
_write_control(key, value) {
|
_write_control(key, value) {
|
||||||
try {
|
try {
|
||||||
const file = Gio.file_new_for_path('/dev/shm/xr_driver_control');
|
Globals.logger.log_debug(`BreezyDesktopExtension _write_control ${key} ${value}`);
|
||||||
const stream = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
|
let proc = Gio.Subprocess.new(
|
||||||
stream.write(`${key}=${value}`, null);
|
['bash', '-c', `echo "${key}=${value}" > /dev/shm/xr_driver_control`],
|
||||||
stream.close(null);
|
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
|
||||||
|
);
|
||||||
|
|
||||||
|
let [success, stdout, stderr] = proc.communicate_utf8(null, null);
|
||||||
|
if (!success || !!stderr)
|
||||||
|
throw new Error(`Failed to write control: ${stderr}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Globals.logger.log(`[ERROR] BreezyDesktopExtension _write_control ${e.message}\n${e.stack}`);
|
Globals.logger.log(`[ERROR] BreezyDesktopExtension _write_control ${e.message}\n${e.stack}`);
|
||||||
}
|
}
|
||||||
|
|
@ -489,15 +499,22 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._setup();
|
this._setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
_handle_breezy_desktop_running_change(effect, _pspec) {
|
_handle_breezy_desktop_running_change(datastream, _pspec) {
|
||||||
Globals.logger.log_debug(`BreezyDesktopExtension _handle_breezy_desktop_running_change ${effect.breezy_desktop_running}`);
|
Globals.logger.log_debug(`BreezyDesktopExtension _handle_breezy_desktop_running_change ${datastream.breezy_desktop_running}`);
|
||||||
|
|
||||||
if (effect.breezy_desktop_running !== this._is_effect_running) {
|
if (datastream.breezy_desktop_running !== this._is_effect_running) {
|
||||||
if (!effect.breezy_desktop_running) Globals.logger.log('Breezy desktop disabled');
|
if (!datastream.breezy_desktop_running) Globals.logger.log('Breezy desktop disabled');
|
||||||
this._setup(!effect.breezy_desktop_running);
|
this._setup(!datastream.breezy_desktop_running);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_handle_show_banner_update(datastream, _pspec) {
|
||||||
|
Globals.logger.log_debug(`BreezyDesktopExtension _handle_show_banner_update ${datastream.show_banner}`);
|
||||||
|
if (this._was_show_banner && !datastream.show_banner) this._recenter_display();
|
||||||
|
|
||||||
|
this._was_show_banner = datastream.show_banner;
|
||||||
|
}
|
||||||
|
|
||||||
_toggle_xr_effect() {
|
_toggle_xr_effect() {
|
||||||
if (!this._cli_file) return;
|
if (!this._cli_file) return;
|
||||||
|
|
||||||
|
|
@ -582,6 +599,10 @@ export default class BreezyDesktopExtension extends Extension {
|
||||||
this._show_banner_binding.unbind();
|
this._show_banner_binding.unbind();
|
||||||
this._show_banner_binding = null;
|
this._show_banner_binding = null;
|
||||||
}
|
}
|
||||||
|
if (this._show_banner_connection) {
|
||||||
|
Globals.data_stream.disconnect(this._show_banner_connection);
|
||||||
|
this._show_banner_connection = null;
|
||||||
|
}
|
||||||
if (this._custom_banner_enabled_binding) {
|
if (this._custom_banner_enabled_binding) {
|
||||||
this._custom_banner_enabled_binding.unbind();
|
this._custom_banner_enabled_binding.unbind();
|
||||||
this._custom_banner_enabled_binding = null;
|
this._custom_banner_enabled_binding = null;
|
||||||
|
|
|
||||||
|
|
@ -929,14 +929,12 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
||||||
|
|
||||||
const containerActor = new Clutter.Actor({
|
const containerActor = new Clutter.Actor({
|
||||||
width: this.target_monitor.width,
|
width: this.target_monitor.width,
|
||||||
height: this.target_monitor.height,
|
height: this.target_monitor.height
|
||||||
reactive: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a clone of the stage content for this monitor
|
// Create a clone of the stage content for this monitor
|
||||||
const monitorClone = new Clutter.Clone({
|
const monitorClone = new Clutter.Clone({
|
||||||
source: Main.layoutManager.uiGroup,
|
source: Main.layoutManager.uiGroup,
|
||||||
reactive: false,
|
|
||||||
x: -monitor.x,
|
x: -monitor.x,
|
||||||
y: -monitor.y
|
y: -monitor.y
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6c051c245a81216434b90193844c817bc1218ba5
|
Subproject commit 831a016d71f638b683157f9d85d5ffc34848a1c1
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit c3b0ddab302e11e517b57b621ff334faf03173de
|
Subproject commit b01239646d7ea6f78a823f591946855b880f0484
|
||||||
Loading…
Reference in New Issue