Skip to content

Commit

Permalink
fix: getNormalBounds() for transparent windows on Windows (#38349)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trop[bot] and codebytere committed May 22, 2023
1 parent 4cfd732 commit 61daccb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
17 changes: 17 additions & 0 deletions spec/api-browser-window-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 61daccb

Please sign in to comment.