fix: broken transparent window styles on resizable change#48378
fix: broken transparent window styles on resizable change#48378codebytere merged 7 commits intoelectron:mainfrom
Conversation
codebytere
left a comment
There was a problem hiding this comment.
@zoy-l the failures are related, see e.g.:
not ok 401 BrowserWindow module window states resizable state does affect maximizability when disabled and enabled
I’ll fix it later. |
|
Hmm, this seems a bit off. I need to test it again.😅 |
The release notes are meant for app developers upgrading their Electron version. They should be relatively simple overall. Example: "Fixed issue where changing Could you update them, please? |
|
@nikwen 👌 |
|
Release Notes Persisted
|
|
I have automatically backported this PR to "38-x-y", please check out #48499 |
|
I have automatically backported this PR to "37-x-y", please check out #48500 |
|
I have automatically backported this PR to "39-x-y", please check out #48501 |
|
Looks like this PR caused a regression: #48554 |
…8378) * fix: wrong api call * fix: consistency of the resize state * fix: edge cases * chore: add detailed comments * fix: lint * chore: only windows * chore: use transparent
…8378) * fix: wrong api call * fix: consistency of the resize state * fix: edge cases * chore: add detailed comments * fix: lint * chore: only windows * chore: use transparent
…8378) * fix: wrong api call * fix: consistency of the resize state * fix: edge cases * chore: add detailed comments * fix: lint * chore: only windows * chore: use transparent
…8378) * fix: wrong api call * fix: consistency of the resize state * fix: edge cases * chore: add detailed comments * fix: lint * chore: only windows * chore: use transparent
Description of Change
Fixes #48421
If resizable: false is set during titleBarOverlay initialization, the maximize button is still available.
Reason: When setting up a transparent window during initialization, calling SetCanResize(true) triggers OnSizeConstraintsChanged. The internal check finds CanResize is true, and since we removed the is_translucent_ check, this causes an unintended window-style flag to be set.
Change Description:
Override the internal
CanResizefunction to prevent inconsistencies with Chromium’s internal state.SetResizableno longer needs to repeatedly triggerOnSizeConstraintsChangedand callSetMaximizable.Background:
Previous Process
SetResizable(true)first triggeredOnSizeConstraintsChanged.can_resizeflag was stillfalse.canMaximizecheck (delegate->CanMaximize() && can_resize) evaluated tofalse, which applied a disabled style.SetMaximizablewas then called to restore the correct style.SetCanResizeupdated Chromium’s internal state and triggeredOnSizeConstraintsChangedagain, correctly applying the style.To fix the background material, the !is_translucent_ check for can_resize was removed in HWNDMessageHandler::SizeConstraintsChanged, which exposed this issue. See fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch for reference.
This brings two changes that need to be confirmed.: one is that windows with thickFrame: false can no longer get the maximize button unless implemented manually. The other is that when thickFrame is false, isResizable is always false under normal circumstances.
Note: In previous versions, transparent windows did not support resizing by dragging the borders.
Checklist
npm testpassesRelease Notes
Notes: Fixed an issue where changing the resizable property on a window would break the styles of a transparent window.