-
Notifications
You must be signed in to change notification settings - Fork 1k
Add flush helper to ClipboardCore #13049
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
Adds a flush helper (this is a public API in WPF). Tweaks some code in WinFormsOleServices for better clarity and error state handling.
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.
PR Overview
This PR adds two new helper APIs to improve clipboard data handling: a new Flush method that flushes clipboard data and an IsObjectOnClipboard method that validates whether a given object is currently on the clipboard. It also updates TryGetData's accessibility and improves error-handling clarity in WinFormsOleServices.
- Added Flush helper in ClipboardCore.cs.
- Introduced IsObjectOnClipboard to check clipboard object equality.
- Updated QueryGetData/GetData error handling in WinFormsOleServices.cs for better clarity.
Reviewed Changes
File | Description |
---|---|
src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs | Added Flush helper and IsObjectOnClipboard including retry logic |
src/System.Windows.Forms/src/System/Windows/Forms/OLE/WinFormsOleServices.cs | Refactored error handling in GetData to separate query and retrieval steps |
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/System.Windows.Forms/src/System/Windows/Forms/OLE/WinFormsOleServices.cs:94
- [nitpick] The variable 'result' is reused for both QueryGetData and GetData calls, which may reduce readability. Consider using a separate variable for the GetData call to enhance clarity.
result = dataObject->GetData(formatEtc, out STGMEDIUM medium);
src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs
Show resolved
Hide resolved
InvokeItemsDialog_ShouldThrowException test took down the run because it hit an assert for a negative test.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13049 +/- ##
===================================================
- Coverage 76.10589% 76.10266% -0.00324%
===================================================
Files 3275 3275
Lines 643778 643804 +26
Branches 47441 47445 +4
===================================================
- Hits 489953 489952 -1
- Misses 150263 150291 +28
+ Partials 3562 3561 -1
Flags with carried forward coverage won't be shown. Click here to find out more. |
src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs
Show resolved
Hide resolved
src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/WinFormsOleServices.cs
Show resolved
Hide resolved
src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs
Show resolved
Hide resolved
Adds a flush helper (this is a public API in WPF). Tweaks some code in WinFormsOleServices for better clarity and error state handling.
Adds a flush helper (this is a public API in WPF). Tweaks some code in WinFormsOleServices for better clarity and error state handling.
Also adds a helper to check if a given object is on the clipboard.
Microsoft Reviewers: Open in CodeFlow