mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: getNormalBounds() for transparent windows on Windows (#38349)
fix: getNormalBounds for transparent windows on Windows Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -786,6 +786,10 @@ gfx::Size NativeWindowViews::GetContentSize() {
|
||||
}
|
||||
|
||||
gfx::Rect NativeWindowViews::GetNormalBounds() {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (IsMaximized() && transparent())
|
||||
return restore_bounds_;
|
||||
#endif
|
||||
return widget()->GetRestoredBounds();
|
||||
}
|
||||
|
||||
|
||||
@@ -1477,6 +1477,23 @@ describe('BrowserWindow module', () => {
|
||||
expect(w.isFullScreen()).to.equal(true);
|
||||
});
|
||||
|
||||
it('checks normal bounds for maximized transparent window', async () => {
|
||||
w.destroy();
|
||||
w = new BrowserWindow({
|
||||
transparent: true,
|
||||
show: false
|
||||
});
|
||||
w.show();
|
||||
|
||||
const bounds = w.getNormalBounds();
|
||||
|
||||
const maximize = emittedOnce(w, 'maximize');
|
||||
w.maximize();
|
||||
await maximize;
|
||||
|
||||
expectBoundsEqual(w.getNormalBounds(), bounds);
|
||||
});
|
||||
|
||||
it('does not change size for a frameless window with min size', async () => {
|
||||
w.destroy();
|
||||
w = new BrowserWindow({
|
||||
|
||||
Reference in New Issue
Block a user