mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: win.isMaximized() for transparent windows on Windows (#38345)
fix: win.isMaximized() for transparent windows Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -640,7 +640,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());
|
||||
|
||||
@@ -6047,6 +6047,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 = 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.
|
||||
ifit(process.platform === 'win32')('can show maximized frameless window', async () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
|
||||
Reference in New Issue
Block a user