Fix some cleanup issues, adjust the trim_width/height values to remove the border

This commit is contained in:
wheaney 2024-05-16 16:16:23 -07:00
parent e9b10838ba
commit c689978e85
4 changed files with 29 additions and 13 deletions

View File

@ -33,6 +33,9 @@ export default class BreezyDesktopExtension extends Extension {
this._overlay = null;
this._target_monitor = null;
this._is_effect_running = false;
this._distance_binding = null;
this._start_binding = null;
this._end_binding = null;
}
enable() {
@ -145,9 +148,9 @@ export default class BreezyDesktopExtension extends Extension {
toggle_display_distance_end: this.settings.get_double('toggle-display-distance-end'),
});
this.settings.bind('display-distance', this._xr_effect, 'display-distance', Gio.SettingsBindFlags.DEFAULT)
this.settings.bind('toggle-display-distance-start', this._xr_effect, 'toggle-display-distance-start', Gio.SettingsBindFlags.DEFAULT)
this.settings.bind('toggle-display-distance-end', this._xr_effect, 'toggle-display-distance-end', Gio.SettingsBindFlags.DEFAULT)
this._distance_binding = this.settings.bind('display-distance', this._xr_effect, 'display-distance', 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._overlay.add_effect_with_name('xr-desktop', this._xr_effect);
Meta.disable_unredirect_for_display(global.display);
@ -209,6 +212,7 @@ export default class BreezyDesktopExtension extends Extension {
Main.wm.removeKeybinding('recenter-display-shortcut');
Main.wm.removeKeybinding('toggle-display-distance-shortcut');
Main.wm.removeKeybinding('toggle-follow-shortcut');
Meta.enable_unredirect_for_display(global.display);
if (this._overlay) {
@ -218,7 +222,20 @@ export default class BreezyDesktopExtension extends Extension {
this._overlay = null;
}
if (this._distance_binding) {
this.settings.unbind(this._distance_binding);
this._distance_binding = null;
}
if (this._start_binding) {
this.settings.unbind(this._start_binding);
this._start_binding = null;
}
if (this._end_binding) {
this.settings.unbind(this._end_binding);
this._end_binding = null;
}
if (this._xr_effect) {
this._xr_effect.cleanup();
this._xr_effect = null;
}

View File

@ -4,11 +4,10 @@ export function getShaderSource(path) {
const file = Gio.file_new_for_path(path);
const data = file.load_contents(null);
const bytes = new Uint8Array(data[1]);
const decoder = new TextDecoder();
const shaderSource = decoder.decode(bytes);
// version string helps with linting, but GNOME extension doesn't like it, so remove it if it's there
//
// TODO - Gjs on GNOME 45.5 WARNING: Some code called array.toString() on a Uint8Array instance. Previously this
// would have interpreted the bytes of the array as a string, but that is nonstandard. In the future this
// will return the bytes as comma-separated digits. For the time being, the old behavior has been preserved,
// but please fix your code anyway to use TextDecoder.
return data[1].toString().replace(/^#version .*$/gm, '') + '\n';
return shaderSource.replace(/^#version .*$/gm, '') + '\n';
}

View File

@ -135,8 +135,8 @@ function setIntermittentUniformVariables() {
// 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
const trimWidthPercent = 2.0 / this.target_monitor.width;
const trimHeightPercent = 2.0 / this.target_monitor.height;
const trimWidthPercent = 3.0 / this.target_monitor.width;
const trimHeightPercent = 3.0 / this.target_monitor.height;
// all these values are transferred directly, unmodified from the driver
transferUniformFloat(this, 'look_ahead_cfg', dataView, LOOK_AHEAD_CFG);
@ -313,7 +313,7 @@ export const XREffect = GObject.registerClass({
this._last_paint = now;
}
vfunc_dispose() {
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);
}

@ -1 +1 @@
Subproject commit 84c2caa96271eb37b02f78c3be1fcb5d641dc247
Subproject commit 26ece497d36bbe2a7445ea2f4e1cce31c35daa3a