Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: black window on screen capture when content protection is enabled #31340

Merged
merged 1 commit into from Oct 11, 2021

Conversation

deermichel
Copy link
Contributor

Description of Change

Closes #29085.

When screen sharing, BrowserWindows with enabled content protection should be transparent on supported Win 10 versions. However, after hiding and showing the window, Windows falls back to a black rectangle as known from the old WDA_MONITOR affinity (though GetWindowDisplayAffinity still returns WDA_EXCLUDEFROMCAPTURE). This workaround mitigates the issue by setting the WS_EX_LAYERED flag on the window.

Please backport to v15 & v16.

Repro fiddle: https://gist.github.com/012544e8dbde6143d809dd82b201b236
Repro steps: run -> aux window will be hidden; press hide & show -> black/transparent rect

cc @codebytere @miniak @zarubond

Checklist

Release Notes

Notes: Fixed black window when screen capturing a content-protected BrowserWindow on Windows 10.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Oct 7, 2021
@zcbenz zcbenz added semver/patch backwards-compatible bug fixes target/15-x-y labels Oct 11, 2021
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 11, 2021
@VerteDinde VerteDinde merged commit 95f81f5 into electron:main Oct 11, 2021
@release-clerk
Copy link

release-clerk bot commented Oct 11, 2021

Release Notes Persisted

Fixed black window when screen capturing a content-protected BrowserWindow on Windows 10.

@trop
Copy link
Contributor

trop bot commented Oct 11, 2021

I have automatically backported this PR to "15-x-y", please check out #31385

@trop
Copy link
Contributor

trop bot commented Oct 11, 2021

I have automatically backported this PR to "16-x-y", please check out #31386

@zcbenz
Copy link
Member

zcbenz commented Oct 22, 2021

/trop run backports

@zcbenz
Copy link
Member

zcbenz commented Oct 22, 2021

/trop run backport

@trop
Copy link
Contributor

trop bot commented Oct 22, 2021

The backport process for this PR has been manually initiated - here we go! :D

@trop
Copy link
Contributor

trop bot commented Oct 22, 2021

I have automatically backported this PR to "13-x-y", please check out #31550

@trop trop bot removed the target/13-x-y label Oct 22, 2021
@trop
Copy link
Contributor

trop bot commented Oct 22, 2021

I have automatically backported this PR to "14-x-y", please check out #31551

t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 27, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 27, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
electron#31340)

Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: setContentProtection issue after hiding and showing the BrowserWindow
3 participants