Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show maximized frameless window #30804

Merged
merged 3 commits into from Sep 7, 2021

Conversation

samuelmaddock
Copy link
Member

@samuelmaddock samuelmaddock commented Sep 2, 2021

Description of Change

fixes #30798

Transparent frameless windows do not support being maximized.

We approximate the maximized state by checking if the window takes up the nearest screen's bounds:

bool NativeWindowViews::IsMaximized() {
if (widget()->IsMaximized()) {
return true;
} else {
#if defined(OS_WIN)
if (transparent()) {
// Compare the size of the window with the size of the display
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
GetNativeWindow());
// Maximized if the window is the same dimensions and placement as the
// display
return GetBounds() == display.work_area();
}
#endif

If that's the case, browserWindow.show() attempts to restore the window to a maximized state which will break its transparency and bounds. See #30798 (comment) for more details.

Checklist

Release Notes

Notes: Fixed transparent frameless windows having an opaque background when opened in a maximized state.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 2, 2021
@samuelmaddock samuelmaddock added target/12-x-y semver/patch backwards-compatible bug fixes labels Sep 2, 2021
@samuelmaddock
Copy link
Member Author

https://ci.appveyor.com/project/electron-bot/electron-92tg5/builds/40614691?fullLog=true#L45020

not ok 490 BrowserWindow module "transparent" option can show maximized frameless window
  AssertionError: expected { x: 0, y: 0, width: 1024, height: 728 } to deeply equal { x: 0, y: 0, width: 1024, height: 768 }
      at Context.<anonymous> (electron\spec-main\api-browser-window-spec.ts:4671:37)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

Test is failing. Will take another look soon.

codebytere
codebytere previously approved these changes Sep 2, 2021
@codebytere codebytere dismissed their stale review September 2, 2021 09:11

oops, accidental 🙃

BrowserWindow will be sized to the workArea when the Windows taskbar is
visible.
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 3, 2021
@codebytere
Copy link
Member

Failure

session module ses.setCertificateVerifyProc(callback) saves cached results

is unrelated.

@codebytere codebytere merged commit fb40065 into electron:main Sep 7, 2021
@release-clerk
Copy link

release-clerk bot commented Sep 7, 2021

Release Notes Persisted

Fixed transparent frameless windows having an opaque background when opened in a maximized state.

@trop
Copy link
Contributor

trop bot commented Sep 7, 2021

I have automatically backported this PR to "13-x-y", please check out #30862

@trop trop bot added the in-flight/13-x-y label Sep 7, 2021
@trop
Copy link
Contributor

trop bot commented Sep 7, 2021

I have automatically backported this PR to "12-x-y", please check out #30863

@trop
Copy link
Contributor

trop bot commented Sep 7, 2021

I have automatically backported this PR to "14-x-y", please check out #30864

@trop
Copy link
Contributor

trop bot commented Sep 7, 2021

I have automatically backported this PR to "15-x-y", please check out #30865

@trop trop bot removed the target/12-x-y label Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Full Screen Transparent Windows are White on Windows 10
3 participants