fix: show maximized frameless window (#30804)
This commit is contained in:
parent
ce6a71e936
commit
fb40065c1e
2 changed files with 38 additions and 1 deletions
|
@ -1629,8 +1629,17 @@ void NativeWindowViews::OnMouseEvent(ui::MouseEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::WindowShowState NativeWindowViews::GetRestoredState() {
|
ui::WindowShowState NativeWindowViews::GetRestoredState() {
|
||||||
if (IsMaximized())
|
if (IsMaximized()) {
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Only restore Maximized state when window is NOT transparent style
|
||||||
|
if (!transparent()) {
|
||||||
|
return ui::SHOW_STATE_MAXIMIZED;
|
||||||
|
}
|
||||||
|
#else
|
||||||
return ui::SHOW_STATE_MAXIMIZED;
|
return ui::SHOW_STATE_MAXIMIZED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (IsFullscreen())
|
if (IsFullscreen())
|
||||||
return ui::SHOW_STATE_FULLSCREEN;
|
return ui::SHOW_STATE_FULLSCREEN;
|
||||||
|
|
||||||
|
|
|
@ -4647,4 +4647,32 @@ describe('BrowserWindow module', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('"transparent" option', () => {
|
||||||
|
afterEach(closeAllWindows);
|
||||||
|
|
||||||
|
// Only applicable on Windows where transparent windows can't be maximized.
|
||||||
|
ifit(process.platform === 'win32')('can show maximized frameless window', async () => {
|
||||||
|
const display = screen.getPrimaryDisplay();
|
||||||
|
|
||||||
|
const w = new BrowserWindow({
|
||||||
|
...display.bounds,
|
||||||
|
frame: false,
|
||||||
|
transparent: true,
|
||||||
|
show: true
|
||||||
|
});
|
||||||
|
|
||||||
|
w.loadURL('about:blank');
|
||||||
|
await emittedOnce(w, 'ready-to-show');
|
||||||
|
|
||||||
|
expect(w.isMaximized()).to.be.true();
|
||||||
|
|
||||||
|
// Fails when the transparent HWND is in an invalid maximized state.
|
||||||
|
expect(w.getBounds()).to.deep.equal(display.workArea);
|
||||||
|
|
||||||
|
const newBounds = { width: 256, height: 256, x: 0, y: 0 };
|
||||||
|
w.setBounds(newBounds);
|
||||||
|
expect(w.getBounds()).to.deep.equal(newBounds);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue