fix: transparent window max/unmax event firing (#32643)
This commit is contained in:
parent
365933f1f3
commit
f5dc2a6535
3 changed files with 34 additions and 3 deletions
|
@ -594,6 +594,7 @@ void NativeWindowViews::Unmaximize() {
|
|||
#if defined(OS_WIN)
|
||||
if (transparent()) {
|
||||
SetBounds(restore_bounds_, false);
|
||||
NotifyWindowUnmaximize();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -187,6 +187,7 @@ void NativeWindowViews::Maximize() {
|
|||
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
|
||||
GetNativeWindow());
|
||||
SetBounds(display.work_area(), false);
|
||||
NotifyWindowMaximize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1119,7 +1119,7 @@ describe('BrowserWindow module', () => {
|
|||
await unmaximize;
|
||||
expectBoundsEqual(w.getNormalBounds(), bounds);
|
||||
});
|
||||
it('can check transparent window maximization', async () => {
|
||||
it('correctly checks transparent window maximization state', async () => {
|
||||
w.destroy();
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
|
@ -1128,12 +1128,12 @@ describe('BrowserWindow module', () => {
|
|||
transparent: true
|
||||
});
|
||||
|
||||
const maximize = emittedOnce(w, 'resize');
|
||||
const maximize = emittedOnce(w, 'maximize');
|
||||
w.show();
|
||||
w.maximize();
|
||||
await maximize;
|
||||
expect(w.isMaximized()).to.equal(true);
|
||||
const unmaximize = emittedOnce(w, 'resize');
|
||||
const unmaximize = emittedOnce(w, 'unmaximize');
|
||||
w.unmaximize();
|
||||
await unmaximize;
|
||||
expect(w.isMaximized()).to.equal(false);
|
||||
|
@ -3266,6 +3266,19 @@ describe('BrowserWindow module', () => {
|
|||
await maximize;
|
||||
});
|
||||
|
||||
it('emits an event when a transparent window is maximized', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
frame: false,
|
||||
transparent: true
|
||||
});
|
||||
|
||||
const maximize = emittedOnce(w, 'maximize');
|
||||
w.show();
|
||||
w.maximize();
|
||||
await maximize;
|
||||
});
|
||||
|
||||
it('emits only one event when frameless window is maximized', () => {
|
||||
const w = new BrowserWindow({ show: false, frame: false });
|
||||
let emitted = 0;
|
||||
|
@ -3284,6 +3297,22 @@ describe('BrowserWindow module', () => {
|
|||
await unmaximize;
|
||||
});
|
||||
|
||||
it('emits an event when a transparent window is unmaximized', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
frame: false,
|
||||
transparent: true
|
||||
});
|
||||
|
||||
const maximize = emittedOnce(w, 'maximize');
|
||||
const unmaximize = emittedOnce(w, 'unmaximize');
|
||||
w.show();
|
||||
w.maximize();
|
||||
await maximize;
|
||||
w.unmaximize();
|
||||
await unmaximize;
|
||||
});
|
||||
|
||||
it('emits an event when window is minimized', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const minimize = emittedOnce(w, 'minimize');
|
||||
|
|
Loading…
Reference in a new issue