fix: window button visibility fullscreen interaction (#34530)
This commit is contained in:
parent
f3f327823e
commit
530a022b05
2 changed files with 43 additions and 4 deletions
|
@ -1517,12 +1517,15 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
||||||
|
|
||||||
void NativeWindowMac::SetWindowButtonVisibility(bool visible) {
|
void NativeWindowMac::SetWindowButtonVisibility(bool visible) {
|
||||||
window_button_visibility_ = visible;
|
window_button_visibility_ = visible;
|
||||||
// The visibility of window buttons are managed by |buttons_proxy_| if the
|
if (buttons_proxy_) {
|
||||||
// style is customButtonsOnHover.
|
if (visible)
|
||||||
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover)
|
[buttons_proxy_ redraw];
|
||||||
[buttons_proxy_ setVisible:visible];
|
[buttons_proxy_ setVisible:visible];
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if (title_bar_style_ != TitleBarStyle::kCustomButtonsOnHover)
|
||||||
InternalSetWindowButtonVisibility(visible);
|
InternalSetWindowButtonVisibility(visible);
|
||||||
|
|
||||||
NotifyLayoutWindowControlsOverlay();
|
NotifyLayoutWindowControlsOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1996,6 +1996,42 @@ describe('BrowserWindow module', () => {
|
||||||
w.setWindowButtonVisibility(false);
|
w.setWindowButtonVisibility(false);
|
||||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('correctly updates when entering/exiting fullscreen for hidden style', async () => {
|
||||||
|
const w = new BrowserWindow({ show: false, frame: false, titleBarStyle: 'hidden' });
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||||
|
w.setWindowButtonVisibility(false);
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||||
|
|
||||||
|
const enterFS = emittedOnce(w, 'enter-full-screen');
|
||||||
|
w.setFullScreen(true);
|
||||||
|
await enterFS;
|
||||||
|
|
||||||
|
const leaveFS = emittedOnce(w, 'leave-full-screen');
|
||||||
|
w.setFullScreen(false);
|
||||||
|
await leaveFS;
|
||||||
|
|
||||||
|
w.setWindowButtonVisibility(true);
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('correctly updates when entering/exiting fullscreen for hiddenInset style', async () => {
|
||||||
|
const w = new BrowserWindow({ show: false, frame: false, titleBarStyle: 'hiddenInset' });
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||||
|
w.setWindowButtonVisibility(false);
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||||
|
|
||||||
|
const enterFS = emittedOnce(w, 'enter-full-screen');
|
||||||
|
w.setFullScreen(true);
|
||||||
|
await enterFS;
|
||||||
|
|
||||||
|
const leaveFS = emittedOnce(w, 'leave-full-screen');
|
||||||
|
w.setFullScreen(false);
|
||||||
|
await leaveFS;
|
||||||
|
|
||||||
|
w.setWindowButtonVisibility(true);
|
||||||
|
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ifdescribe(process.platform === 'darwin')('BrowserWindow.setVibrancy(type)', () => {
|
ifdescribe(process.platform === 'darwin')('BrowserWindow.setVibrancy(type)', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue