Handle siblings added/removed from the stage

This commit is contained in:
wheaney 2024-09-25 14:42:18 -07:00
parent 31693bdece
commit 230f93466a
2 changed files with 28 additions and 2 deletions

View File

@ -56,6 +56,8 @@ export default class BreezyDesktopExtension extends Extension {
this._disable_anti_aliasing_binding = null;
this._optimal_monitor_config_binding = null;
this._headset_as_primary_binding = null;
this._actor_added_connection = null;
this._actor_removed_connection = null;
if (!Globals.logger) {
Globals.logger = new Logger({
@ -263,8 +265,19 @@ export default class BreezyDesktopExtension extends Extension {
this._overlay.set_child(overlayContent);
global.stage.insert_child_above(this._overlay, null);
Shell.util_set_hidden_from_pick(this._overlay, true);
global.stage.add_child(this._overlay);
// In GS 45, use of "actor" was renamed to "child".
const clutterContainer = Clutter.Container !== undefined;
this._actor_added_connection = global.stage.connect(
clutterContainer ? 'actor-added' : 'child-added',
this._handle_sibling_update.bind(this),
);
this._actor_removed_connection = global.stage.connect(
clutterContainer ? 'actor-removed' : 'child-removed',
this._handle_sibling_update.bind(this),
);
this._xr_effect = new XREffect({
target_monitor: targetMonitor,
@ -310,6 +323,11 @@ export default class BreezyDesktopExtension extends Extension {
}
}
_handle_sibling_update() {
Globals.logger.log_debug('BreezyDesktopExtension _handle_sibling_update()');
global.stage.set_child_above_sibling(this._overlay, null);
}
_add_settings_keybinding(settings_key, bind_to_function) {
try {
Main.wm.addKeybinding(
@ -494,6 +512,14 @@ export default class BreezyDesktopExtension extends Extension {
Main.wm.removeKeybinding('toggle-follow-shortcut');
Meta.enable_unredirect_for_display(global.display);
if (this._actor_added_connection) {
global.stage.disconnect(this._actor_added_connection);
this._actor_added_connection = null;
}
if (this._actor_removed_connection) {
global.stage.disconnect(this._actor_removed_connection);
this._actor_removed_connection = null;
}
if (this._overlay) {
if (this._xr_effect) this._xr_effect.cleanup();
this._overlay.remove_effect_by_name('xr-desktop');

@ -1 +1 @@
Subproject commit 4ff0de0aa4cfc5b4fecdd5c7294eba09e3f5fde7
Subproject commit 1d0ead14b293c58c661c5589cb8919cf8482b4de