fix: respect setAlwaysOnTop before showInactive on Linux under X11 (#44325)

fix: respect setAlwaysOnTop before showInactive on Linux under X11 (#44078)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Beutner <31829097+cptpcrd@users.noreply.github.com>
This commit is contained in:
trop[bot] 2024-10-18 16:19:43 -04:00 committed by GitHub
parent 7cfbdfaf34
commit 15486ec73d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -543,6 +543,11 @@ void NativeWindowViews::ShowInactive() {
#if BUILDFLAG(IS_LINUX)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
// On X11, setting Z order before showing the window doesn't take effect,
// so we have to call it again.
if (IsX11())
widget()->SetZOrderLevel(widget()->GetZOrderLevel());
#endif
}

View file

@ -2508,6 +2508,22 @@ describe('BrowserWindow module', () => {
expect(c.isAlwaysOnTop()).to.be.true('child is not always on top');
expect(c._getAlwaysOnTopLevel()).to.equal('screen-saver');
});
it('works when called prior to show', async () => {
w = new BrowserWindow({ show: false });
w.setAlwaysOnTop(true, 'screen-saver');
w.show();
await setTimeout(1000);
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});
it('works when called prior to showInactive', async () => {
w = new BrowserWindow({ show: false });
w.setAlwaysOnTop(true, 'screen-saver');
w.showInactive();
await setTimeout(1000);
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});
});
describe('preconnect feature', () => {