fix: user resizable transparent windows on win32#49428
fix: user resizable transparent windows on win32#49428jkleinsc merged 1 commit intoelectron:mainfrom
Conversation
|
Here is my test matrix to gauge user impact... commonOptions = {
width: 800,
height: 600,
maxWidth: 1000,
minWidth: 400,
}
|
|
Hi @zoy-l, Here is the PR for the win32 resize regression. I kept the changes as minimal as possible and attempted to keep behavior identical to docs/pre-39. |
|
@mayfield Hey, I'm not an API reviewer, so I can't really give any suggestions. Please be patient — someone will review it. |
This commit addresses the transparent window rendering issues on Windows: 1. Apply PR electron#49428 fix for CanResize() and IsResizable() - Frameless windows use hit-test based resize, not WS_THICKFRAME - CanResize() now returns resizable_ for frameless windows - IsResizable() simplified to delegate to CanResize() 2. Add SetIsTranslucent(false) for transparent windows after widget init - During widget creation, transparent windows get is_translucent_=true - This causes Win11 background material patch to call DefWindowProc(-1) - On some hardware, this causes black/grey backgrounds on focus events - Explicitly setting is_translucent_=false prevents this issue 3. Keep SetBackgroundMaterial() early return for transparent windows - Background materials (Mica/Acrylic) are not appropriate for transparent windows Fixes: electron#48554 See: electron#49428 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@nikwen I'm in fear that this is bit rotting. Can you provide any guidance or direct me towards avenues for raising the prio, i.e. sponsorship, proposals, better PR conformance? I apologize if I'm still not being patient enough, I do value your time. |
|
Sorry, we currently have a long backlog of PRs. I'm not the right person to review this. I hope someone will get to it soon. |
codebytere
left a comment
There was a problem hiding this comment.
@mayfield can you please verify your commit?
| #if BUILDFLAG(IS_WIN) | ||
| if (has_frame()) | ||
| return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME; | ||
| #endif |
There was a problem hiding this comment.
This code has been around for ~9 years and your PR doesn't describe how this fixes it or why it regressed - why was this removed?
There was a problem hiding this comment.
There is a more in-depth discussion here #48554 (comment)
The PR's assertion is that window resizing for win32 is not a special-case because chromium facilitates resizing internally with its own hit-test method (outlined in above comment(s)). This hit-test method is, however, tied to CanResize, as it defers to the shell as the authority on what's permitted. This PR seeks to consolidate the behavior and expectations of IsResizable (and CanResize) to be more consistent, and remove the incorrect assumption that resizing on win32 requires the WS_THICKFRAME flag (in the most minimal way possible as a first time electron committer).
I should note, based on the comments in much of the electron shell/browser/native_window_view.cc code, I believe there is some confusion about what WS_THICKFRAME means. It's also an alias for WS_SIZEBOX and despite being very poorly documented by microsoft, more or less just means the window can be sized using an external OS border (https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles). It doesn't mean the window is not allowed to size itself, as chromium indeed can and does do.
8209374 to
7f83b3b
Compare
|
@mayfield this test failure looks related: |
|
re: test failure Looks like this test was changed as part of the original regression, 3a53c71 I think the remediation is to change this back to If you agree, I can add a commit to this effect or if you prefer single commits, I can replace the current one. Let me know what you think/prefer @codebytere. |
7f83b3b to
1cff204
Compare
|
Hi @codebytere Let me know how I can help or what I should do next. |
|
@mayfield can you rebase your PR with the latest from main? |
1cff204 to
45deeab
Compare
test: revert win32 frameless and transparent resizable expectations
45deeab to
d98a6e4
Compare
|
Hi again, in a couple days we celebrate the 2 month anniversary of this PR! :) Please let me know what I can do to help push this forward; I am at your disposal. |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
Release Notes Persisted
|
|
I have automatically backported this PR to "41-x-y", please check out #50298 |
|
I have automatically backported this PR to "42-x-y", please check out #50299 |
|
I have automatically backported this PR to "39-x-y", please check out #50300 |
|
I have automatically backported this PR to "40-x-y", please check out #50301 |
Closes: #48554
Description of Change
Frameless windows use hit-test based resize in chromium. Version 39 of electron regressed resizable windows that did not have a "frame" on win32.
Checklist
npm testpassesI ran tests but there were 245 fails that seemed to have nothing to do with my change. I don't know if HEAD is broken or if my windows VM is not setup correctly.
Release Notes
notes: Fixed user resizing of transparent windows on win32 platform