Skip to content

Conversation

zoy-l
Copy link
Contributor

@zoy-l zoy-l commented Sep 25, 2025

Description of Change

Fix: #4835
Fix #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 CanResize function to prevent inconsistencies with Chromium’s internal state.
SetResizable no longer needs to repeatedly trigger OnSizeConstraintsChanged and call SetMaximizable.

Background:
Previous Process

  1. Calling SetResizable(true) first triggered OnSizeConstraintsChanged.
  2. At that moment, the internal can_resize flag was still false.
  3. The canMaximize check (delegate->CanMaximize() && can_resize) evaluated to false, which applied a disabled style.
  4. SetMaximizable was then called to restore the correct style.
  5. Finally, SetCanResize updated Chromium’s internal state and triggered OnSizeConstraintsChanged again, 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

Release Notes

Notes: Fixed an issue where changing the resizable property on a window would break the styles of a transparent window.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Sep 25, 2025
codebytere
codebytere previously approved these changes Sep 25, 2025
@codebytere codebytere dismissed their stale review September 25, 2025 20:07

meant to comment

Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@zoy-l
Copy link
Contributor Author

zoy-l commented Sep 26, 2025

@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.

@zoy-l zoy-l marked this pull request as draft September 29, 2025 18:29
@zoy-l
Copy link
Contributor Author

zoy-l commented Sep 29, 2025

Hmm, this seems a bit off. I need to test it again.😅

@zoy-l zoy-l marked this pull request as ready for review September 30, 2025 14:00
@nikwen
Copy link
Member

nikwen commented Sep 30, 2025

Notes: 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.

The release notes are meant for app developers upgrading their Electron version. They should be relatively simple overall.

Example: "Fixed issue where changing resizable on a window caused <explain bug>."

Could you update them, please?

@zoy-l
Copy link
Contributor Author

zoy-l commented Sep 30, 2025

@nikwen 👌

@zoy-l zoy-l changed the title fix: resizable wrong api call fix: broken transparent window styles on resizable change Sep 30, 2025
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. labels Oct 3, 2025
@electron-cation electron-cation bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Oct 3, 2025
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 target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting a transparent window to be resizable breaks transparency Icon not showing up in Ubuntu's launcher
3 participants