Skip to content

Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE#187848

Merged
mattkae merged 5 commits into
flutter:masterfrom
canonical:bugfix-multi-window-win32
Jun 12, 2026
Merged

Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE#187848
mattkae merged 5 commits into
flutter:masterfrom
canonical:bugfix-multi-window-win32

Conversation

@mattkae

@mattkae mattkae commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This pull request makes multi-window functional on Windows 10 and removes an unnecessary call during window setup.

What's new?

  • Removes call to EnableTransparentWindowBackground on HostWindow create. In fact, this does not work at all 🎉 Transparency on popups was not implemented with the current implementation. We should do something more complex to make it work, but it has clearly been broken for a while now

fixes #186522

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@mattkae mattkae requested a review from a team as a code owner June 11, 2026 12:58
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 11, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically a: desktop Running on desktop team-windows Owned by the Windows platform team labels Jun 11, 2026
@mattkae mattkae requested review from knopp and loic-sharma June 11, 2026 12:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request restricts transparent window backgrounds to Windows 11 or newer by dynamically loading RtlGetVersion from ntdll.dll in WindowsProcTable and exposing an IsWindows11OrGreater helper. Feedback on the changes highlights a potential null pointer dereference and crash if ntdll.dll fails to load or if RtlGetVersion cannot be resolved, suggesting safe checks before assigning the function pointer.

Comment on lines +29 to +30
ntdll_ = fml::NativeLibrary::Create("ntdll.dll");
rtl_get_version_ = ntdll_->ResolveFunction<RtlGetVersion_*>("RtlGetVersion");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Calling ResolveFunction on ntdll_ without checking if fml::NativeLibrary::Create succeeded can lead to a null pointer dereference and crash if ntdll_ is null. Additionally, if ResolveFunction fails to find RtlGetVersion (returning nullptr), assigning it directly to rtl_get_version_ will result in rtl_get_version_.has_value() being true but containing a nullptr, which would cause a crash when called in IsWindows11OrGreater.

We should safely check ntdll_ and only populate rtl_get_version_ if the resolved function pointer is non-null.

  ntdll_ = fml::NativeLibrary::Create("ntdll.dll");
  if (ntdll_) {
    auto rtl_get_version =
        ntdll_->ResolveFunction<RtlGetVersion_*>( "RtlGetVersion" );
    if (rtl_get_version) {
      rtl_get_version_ = rtl_get_version;
    }
  }

@mattkae

mattkae commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

CC: @9AZX

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 11, 2026
@mattkae mattkae changed the title Making EnableTransparentWindowBackground a no-op on Windows 10 because it does not support DWMWA_SYSTEMBACKDROP_TYPE Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE Jun 11, 2026
@9AZX

9AZX commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Nice 👍🏼

image

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 11, 2026
@mattkae mattkae changed the title Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE Making EnableTransparentWindowBackground a no-op on Windows 10 because it does not support DWMWA_SYSTEMBACKDROP_TYPE Jun 11, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 11, 2026
@mattkae mattkae changed the title Making EnableTransparentWindowBackground a no-op on Windows 10 because it does not support DWMWA_SYSTEMBACKDROP_TYPE Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE Jun 11, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 11, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@mattkae mattkae enabled auto-merge June 11, 2026 19:58
@mattkae mattkae added this pull request to the merge queue Jun 12, 2026
Merged via the queue into flutter:master with commit 27226d4 Jun 12, 2026
202 checks passed
@mattkae mattkae deleted the bugfix-multi-window-win32 branch June 12, 2026 13:18
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 12, 2026
flutter/flutter@8bdce07...b7cb925

2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from cadbde1ec4b7 to 8c89bf2b0ee3 (5 revisions) (flutter/flutter#187926)
2026-06-12 engine-flutter-autoroll@skia.org Roll Packages from 1b56cde to b78ad83 (5 revisions) (flutter/flutter#187928)
2026-06-12 engine-flutter-autoroll@skia.org Roll Dart SDK from f3441f2067ae to f6c31f4c3a63 (17 revisions) (flutter/flutter#187924)
2026-06-12 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 2KosSR4ONUjIB7tP_... to A3eaUn9mQ_EkSNxVI... (flutter/flutter#187923)
2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from a2228b926c68 to cadbde1ec4b7 (9 revisions) (flutter/flutter#187921)
2026-06-12 kustermann@google.com Remove dynamic module loading code in flutter web engine (flutter/flutter#187777)
2026-06-12 matt.kosarek@canonical.com Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE (flutter/flutter#187848)
2026-06-12 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from dQ4PjIJB5kZFU8Y32... to EmfiOMUge_nnNS33B... (flutter/flutter#187912)
2026-06-12 mvincentong@gmail.com Clarify RichText selection docs (flutter/flutter#186844)
2026-06-12 1063596+reidbaker@users.noreply.github.com Custom KGP task and migration to AGP api for geting kgp version (flutter/flutter#182788)
2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from f61acb31edf8 to a2228b926c68 (5 revisions) (flutter/flutter#187896)
2026-06-12 bdero@google.com [Flutter GPU] Expose ASTC HDR texture formats (flutter/flutter#187715)
2026-06-12 awolff@google.com Expand coverage of android_hardware_smoke_test. Add image, text, blend mode, and blur tests. (flutter/flutter#187600)
2026-06-11 bdero@google.com [Flutter GPU] Add blit operations (flutter/flutter#187289)
2026-06-11 bkonyi@google.com [flutter_tools] Fix version cache git fallback performance regression (flutter/flutter#187400)
2026-06-11 nshahan@google.com Rewrite `-d web-server` hot reload/restart tests (flutter/flutter#187453)
2026-06-11 bdero@google.com [Impeller] Allow sampling textures with manually-uploaded mip levels (flutter/flutter#187729)
2026-06-11 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#187884)
2026-06-11 47866232+chunhtai@users.noreply.github.com iOS a11y sets header trait based on heading level (flutter/flutter#186916)
2026-06-11 engine-flutter-autoroll@skia.org Roll Skia from 9f02102df298 to f61acb31edf8 (19 revisions) (flutter/flutter#187869)
2026-06-11 engine-flutter-autoroll@skia.org Roll ICU from ee5f27adc28b to d578f2e8b7bd (8 revisions) (flutter/flutter#187829)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
loic-sharma pushed a commit to LongCatIsLooong/flutter that referenced this pull request Jun 18, 2026
…tant and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE (flutter#187848)

This pull request makes multi-window functional on Windows 10 and
removes an unnecessary call during window setup.

## What's new?
- Removes call to `EnableTransparentWindowBackground` on `HostWindow`
create. In fact, this does not work at all 🎉 Transparency on popups
was not implemented with the current implementation. We should do
something more complex to make it work, but it has clearly been broken
for a while now

fixes flutter#186522

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
@loic-sharma

Copy link
Copy Markdown
Member

Beta cherry pick PR: #188186

auto-submit Bot pushed a commit that referenced this pull request Jun 25, 2026
…hing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE (#187848) (#188186)

This is for fixing a flaky test so no changlog entries needed.

Hopefully this resolves #188182

I doubt we can use the auto-CP bot because the initial beta has not been released.

Original PR: #187848

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…tant and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE (flutter#187848)

This pull request makes multi-window functional on Windows 10 and
removes an unnecessary call during window setup.

## What's new?
- Removes call to `EnableTransparentWindowBackground` on `HostWindow`
create. In fact, this does not work at all 🎉 Transparency on popups
was not implemented with the current implementation. We should do
something more complex to make it work, but it has clearly been broken
for a while now

fixes flutter#186522

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

windows 10 multi window bug when using examples\multiple_windows

3 participants