fix: win.isMaximized()
for transparent windows on Windows (#38234)
This commit is contained in:
parent
9902e01d2c
commit
ad07712561
2 changed files with 19 additions and 1 deletions
|
@ -656,7 +656,7 @@ bool NativeWindowViews::IsMaximized() {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
if (transparent()) {
|
if (transparent() && !IsMinimized()) {
|
||||||
// Compare the size of the window with the size of the display
|
// Compare the size of the window with the size of the display
|
||||||
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
|
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
|
||||||
GetNativeWindow());
|
GetNativeWindow());
|
||||||
|
|
|
@ -6059,6 +6059,24 @@ describe('BrowserWindow module', () => {
|
||||||
describe('"transparent" option', () => {
|
describe('"transparent" option', () => {
|
||||||
afterEach(closeAllWindows);
|
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 = once(w, 'maximize');
|
||||||
|
w.maximize();
|
||||||
|
await maximize;
|
||||||
|
|
||||||
|
const minimize = once(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.
|
// Only applicable on Windows where transparent windows can't be maximized.
|
||||||
ifit(process.platform === 'win32')('can show maximized frameless window', async () => {
|
ifit(process.platform === 'win32')('can show maximized frameless window', async () => {
|
||||||
const display = screen.getPrimaryDisplay();
|
const display = screen.getPrimaryDisplay();
|
||||||
|
|
Loading…
Reference in a new issue