-
Notifications
You must be signed in to change notification settings - Fork 1k
Update SetScreenCaptureModeInternal by reset WINDOW_DISPLAY_AFFINITY to NONE before setting new affinity #13684
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
base: main
Are you sure you want to change the base?
Update SetScreenCaptureModeInternal by reset WINDOW_DISPLAY_AFFINITY to NONE before setting new affinity #13684
Conversation
…to NONE before setting new affinity
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.
Pull Request Overview
This PR ensures that SetScreenCaptureModeInternal
properly clears any existing WINDOW_DISPLAY_AFFINITY
before applying a new screen-capture mode, fixing a regression when setting the property multiple times.
- Always reset window display affinity to
WDA_NONE
before computing the new affinity. - Retains the existing switch logic to map
ScreenCaptureMode
to the correctWINDOW_DISPLAY_AFFINITY
.
Comments suppressed due to low confidence (1)
src/System.Windows.Forms/System/Windows/Forms/Form.cs:1794
- Add automated tests that set
FormScreenCaptureMode
multiple times and verify the display affinity resets correctly, ensuring this change is covered by unit tests.
PInvoke.SetWindowDisplayAffinity(HWND, WINDOW_DISPLAY_AFFINITY.WDA_NONE);
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13684 +/- ##
===================================================
+ Coverage 76.60680% 76.69345% +0.08664%
===================================================
Files 3253 3255 +2
Lines 641011 641605 +594
Branches 47442 47491 +49
===================================================
+ Hits 491058 492069 +1011
+ Misses 146303 145882 -421
- Partials 3650 3654 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
looks good
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.
All LGTM!
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.
Thanks!
Fixes #13680
Proposed changes
SetScreenCaptureModeInternal
by resetWINDOW_DISPLAY_AFFINITY
toNONE
before setting new affinityCustomer Impact
FormScreenCaptureMode
still works properly after multiple callsRegression?
Risk
Screenshots
Before
When the FormScreenCaptureMode property is set twice in succession, ScreenCaptureMode always retains the first setting.
FormScreenCaptureModeIssue.mp4
After
AfterChange.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow