Skip to content

Conversation

zoy-l
Copy link
Contributor

@zoy-l zoy-l commented Apr 29, 2025

Description of Change

fix: #46753, #43345, #43196, #46882

PS: The description was written with the help of translation 🫡

  1. The main reason for the background material becoming invalid is that when the window is maximized, Chromium calls GetDwmFrameInsetsInPixels to determine whether an update is needed and sets DwmExtendFrameIntoClientArea, which disrupts the background effect.
  2. Because Chromium internal, translucent value is never updated after initialization, subsequent operations like maximizing or entering fullscreen can break the background material.
  3. Because Chromium internal, translucent seems to be treated as a frameless window, which causes a white title bar to appear during subsequent updates.

Fixed applying background material correctly when creating windows on Windows, restored animations, and also fixed the issue where dynamically setting the background material had no effect.

20250429-220522.mp4

Checklist

Release Notes

Notes: Fix inconsistent materials (Acrylic/Mica) and rounded corners in borderless browser window during maximize/restore operations on Windows 11

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Apr 29, 2025
@zoy-l zoy-l marked this pull request as draft April 29, 2025 14:17
@zoy-l
Copy link
Contributor Author

zoy-l commented Apr 30, 2025

😎Progress has been made on dynamically setting the background material. However, there's a 5-day holiday starting in my region, so I may need to wait until after the break to continue and complete the PR.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label May 6, 2025
@zoy-l zoy-l marked this pull request as ready for review May 7, 2025 15:24
@zoy-l zoy-l requested a review from a team as a code owner May 7, 2025 15:24
@zoy-l
Copy link
Contributor Author

zoy-l commented May 7, 2025

20250507-232819.mp4

Additional demonstration included.

    if (backgroundMaterial === 'auto') {
      mainWindow?.setBackgroundColor('#00000000');
      mainWindow?.setBackgroundMaterial('acrylic');
      backgroundMaterial = 'acrylic';
    } else {
      mainWindow?.setBackgroundColor('#ffffff');
      mainWindow?.setBackgroundMaterial('auto');
      backgroundMaterial = 'auto';
    }

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label May 7, 2025
+ // translucent framed windows. Original code: !is_translucent_ &&
+ // delegate_->CanResize() See:
+ // https://chromium-review.googlesource.com/c/chromium/src/+/6372329
+ const bool can_resize = delegate_->CanResize();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to address the issue where a window with a frame and background material cannot be maximized.

@zoy-l zoy-l marked this pull request as draft May 8, 2025 15:35
@zoy-l zoy-l marked this pull request as ready for review May 8, 2025 17:59
@zoy-l zoy-l force-pushed the fix_background_material branch from 5bddd27 to 14b719f Compare May 10, 2025 15:07
@jkleinsc jkleinsc requested a review from clavin May 12, 2025 15:02
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label May 15, 2025
@codebytere
Copy link
Member

@zoy-l could you rebase this please?

- if (!is_translucent_ && !custom_window_region_.is_valid() &&
+ // patch: fix_resolve_dynamic_background_material_update_issue_on_windows_11
+ // Our translucent windows use the native frame by default, and we should not
+ // set a custom region when the window is maximized; otherwise, it will cause
Copy link
Member

Choose a reason for hiding this comment

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

Can all or part of this be upstreamed to Chromium?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codebytere I don't have much experience with this, but I can give it a try

@zoy-l zoy-l force-pushed the fix_background_material branch from c209317 to 502f7c4 Compare May 19, 2025 11:13
@@ -103,7 +103,6 @@ fix_use_delegated_generic_capturer_when_available.patch
expose_webblob_path_to_allow_embedders_to_get_file_paths.patch
fix_move_autopipsettingshelper_behind_branding_buildflag.patch
revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch
fix_activate_background_material_on_windows.patch
Copy link
Member

Choose a reason for hiding this comment

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

Did you intend to delete this? if yes, you also need to delete the patch file itself

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I might have missed this part during the rebase.😓

@zoy-l
Copy link
Contributor Author

zoy-l commented May 21, 2025

Perhaps some of the patches can be reduced by using SetWindowSubclass (@codebytere Any thoughts?) , but the modifications to ResetWindowRegion and can_resize are unlikely to be accepted upstream. I can try pushing the SetIsTranslucent method upstream.

@zoy-l
Copy link
Contributor Author

zoy-l commented May 29, 2025

Leave a legacy, might be of some reference value if someone wants to continue~ I don't have time to work on it right now.

@codebytere
Copy link
Member

@zoy-l would you be willing to briefly say where you left off? What still needs to be done here?

@zoy-l
Copy link
Contributor Author

zoy-l commented Jun 4, 2025

@codebytere Functionally everything is fine and working as expected — the above was only mentioned to reduce the number of patches. However, I did notice that a few tests related to webContentSize failed when I ran the tests locally, though I haven’t looked into them.

@codebytere
Copy link
Member

@zoy-l awesome, thanks! that helps a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows 11: Material (Acrylic/Mica) and Rounded Corners Inconsistencies in Frameless BrowserWindow Maximize/Restore Actions
2 participants