Skip to content

Commit

Permalink
fix: add missing set_wants_to_be_visible(true) to `NativeWindowMac:…
Browse files Browse the repository at this point in the history
…:ShowInactive()` (#40657)

* fix: add missing set_wants_to_be_visible(true) to NativeWindowMac::ShowInactive()

Co-authored-by: zaza <tamas@miro.com>

* add test

Co-authored-by: Tamás Zahola <tzahola@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: zaza <tamas@miro.com>
Co-authored-by: Tamás Zahola <tzahola@gmail.com>
  • Loading branch information
3 people committed Nov 30, 2023
1 parent a0af9e0 commit 4cfc4bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shell/browser/native_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
}

void NativeWindowMac::ShowInactive() {
set_wants_to_be_visible(true);

// Reattach the window to the parent to actually show it.
if (parent())
InternalSetParentWindow(parent(), true);
Expand Down
28 changes: 28 additions & 0 deletions spec/api-browser-window-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,34 @@ describe('BrowserWindow module', () => {
await shown;
expect(w.isMaximized()).to.equal(true);
});

ifit(process.platform === 'darwin')('should attach child window to parent', async () => {
const wShow = once(w, 'show');
w.show();
await wShow;

const c = new BrowserWindow({ show: false, parent: w });
const cShow = once(c, 'show');
c.showInactive();
await cShow;

// verifying by checking that the child tracks the parent's visibility
const minimized = once(w, 'minimize');
w.minimize();
await minimized;

expect(w.isVisible()).to.be.false('parent is visible');
expect(c.isVisible()).to.be.false('child is visible');

const restored = once(w, 'restore');
w.restore();
await restored;

expect(w.isVisible()).to.be.true('parent is visible');
expect(c.isVisible()).to.be.true('child is visible');

closeWindow(c);
});
});

describe('BrowserWindow.focus()', () => {
Expand Down

0 comments on commit 4cfc4bf

Please sign in to comment.