-
Notifications
You must be signed in to change notification settings - Fork 16.1k
fix: setContentProtection(true)
after hide on Windows
#45868
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
Conversation
DWORD affinity = enable ? WDA_EXCLUDEFROMCAPTURE : WDA_NONE; | ||
::SetWindowDisplayAffinity(hwnd, affinity); | ||
if (!layered_) { | ||
// Workaround to prevent black window on screen capture after hiding and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested to ensure no black window regression!
9dcbe9a
to
838ba0e
Compare
838ba0e
to
5a7e873
Compare
Release Notes Persisted
|
I have automatically backported this PR to "35-x-y", please check out #45889 |
I have automatically backported this PR to "34-x-y", please check out #45890 |
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); | ||
layered_ = true; | ||
} | ||
widget()->native_widget_private()->SetAllowScreenshots(!enable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this issue being fixed! One question though, won't this change behavior since Chromium uses WDA_MONITOR instead of WDA_EXCLUDEFROMCAPTURE? here: https://source.chromium.org/chromium/chromium/src/+/main:ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc;l=1476?q=SetAllowScreenshots&ss=chromium%2Fchromium%2Fsrc&start=21
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue.
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue.
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Fixes #45990 We previously made a change in #45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Description of Change
Fixes #45844.
Refs CL:5789117
This PR fixes an issue where
setContentProtection(true)
was reverted when a given window was hidden. This happened as a result of the above CL, which added logic to avoid setting content protection when a window was hidden. That wouldn't be an issue, except that we weren't using the upstreamWidget
functionality, and so when it went to ensure protection state after re-showing it, the status was incorrect. Fix this by leveraging upstream functionality. This PR additionally adds testing and a currently private getter function for content protection status so we can test and prevent regressions in the future. I'll look to expose that in a follow-up PR.Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where
setContentProtection(true)
was reverted when a given window was hidden.