Skip to content

Commit

Permalink
fix: getNormalBounds for transparent windows on Win
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed May 5, 2023
1 parent bc957e3 commit eb0f47d
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 @@ -761,6 +761,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 @@ -1665,6 +1665,23 @@ describe('BrowserWindow module', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
});

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 = once(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 eb0f47d

Please sign in to comment.