Add fullscreen handler

This commit is contained in:
wheaney 2024-03-31 17:33:28 -04:00
parent 0e32ccc7da
commit bee05f9257
1 changed files with 32 additions and 2 deletions

View File

@ -284,7 +284,37 @@ export default class BreezyDesktopExtension extends Extension {
});
this._xr_effect = new XREffect();
global.stage.add_effect(this._xr_effect);
global.stage.add_effect_with_name('xr-desktop', this._xr_effect);
this._attached_to_actor = global.stage;
let handleFullscreenUpdate = (() => {
console.log('\tBreezy fullscreen update\n');
let currentWindow = global.display.sort_windows_by_stacking(global.display.list_all_windows()).find(window => window === global.display.focus_window || window.is_fullscreen());
// let currentWindow = global.display.focus_window;
if (currentWindow.is_fullscreen()) {
const windowActor = currentWindow.find_root_ancestor().get_compositor_private();
console.log('\tBreezy fullscreen update 1\n');
if (this._attached_to_actor !== windowActor) {
console.log('\tBreezy fullscreen update 2\n');
this._attached_to_actor.remove_effect_by_name('xr-desktop');
windowActor.add_effect_with_name('xr-desktop', this._xr_effect);
this._attached_to_actor = windowActor;
console.log('\tBreezy fullscreen update 5\n');
}
} else {
console.log('\tBreezy fullscreen update 3\n');
if (this._attached_to_actor !== global.stage) {
console.log('\tBreezy fullscreen update 4\n');
this._attached_to_actor.remove_effect_by_name('xr-desktop');
global.stage.add_effect_with_name('xr-desktop', this._xr_effect);
this._attached_to_actor = global.stage;
console.log('\tBreezy fullscreen update 6\n');
}
}
}).bind(this);
// global.display.connect('in-fullscreen-changed', handleFullscreenUpdate);
// global.display.connect('notify::focus-window', handleFullscreenUpdate);
}
disable() {
@ -297,4 +327,4 @@ export default class BreezyDesktopExtension extends Extension {
function init() {
return new Extension();
}
}