Skip to content

Commit

Permalink
fix: win.isMaximized() for transparent windows
Browse files Browse the repository at this point in the history
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
trop[bot] and codebytere committed May 17, 2023
1 parent be3e7bc commit 93ca684
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ bool NativeWindowViews::IsMaximized() {
return true;
} else {
#if BUILDFLAG(IS_WIN)
if (transparent()) {
if (transparent() && !IsMinimized()) {
// Compare the size of the window with the size of the display
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
GetNativeWindow());
Expand Down
18 changes: 18 additions & 0 deletions spec/api-browser-window-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5578,6 +5578,24 @@ describe('BrowserWindow module', () => {
describe('"transparent" option', () => {
afterEach(closeAllWindows);

ifit(process.platform !== 'linux')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
const w = new BrowserWindow({
frame: false,
transparent: true
});

const maximize = emittedOnce(w, 'maximize');
w.maximize();
await maximize;

const minimize = emittedOnce(w, 'minimize');
w.minimize();
await minimize;

expect(w.isMaximized()).to.be.false();
expect(w.isMinimized()).to.be.true();
});

// 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();
Expand Down

0 comments on commit 93ca684

Please sign in to comment.