-
Notifications
You must be signed in to change notification settings - Fork 832
fix: Add DragUI support for external drag operations on Windows (Skia/WPF and Skia/Win32) (backport #21759) #21986
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: release/stable/6.4
Are you sure you want to change the base?
fix: Add DragUI support for external drag operations on Windows (Skia/WPF and Skia/Win32) (backport #21759) #21986
Conversation
…xtension Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 7e1dcee)
Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 2ead42b)
Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 827eaa6)
Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 122cc0d)
Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 7012547)
…pExtension Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit 1d79256)
…tion Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit c4699b5)
(cherry picked from commit 69a0cbf)
(cherry picked from commit b5e891f)
(cherry picked from commit 97378a2)
(cherry picked from commit 53abcc1)
(cherry picked from commit 0d6eeec)
|
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21986/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21986/wasm-skia-net9/index.html |
|
|
GitHub Issue: closes #[issue_number]
PR Type:
What is the current behavior? 🤔
Dragging image files from File Explorer into Uno Platform applications on Windows (Skia/WPF and Skia/Win32) shows no thumbnail near the cursor during the drag operation.
What is the new behavior? 🚀
External drag operations now display image thumbnails near the cursor on both Skia rendering backends. The implementation:
WPF Target Implementation
WpfDragDropExtension.OnHostDragEnternow creates aDragUIinstance for external drags (previously null)CreateDragUIForExternalDrag- Creates DragUI with thumbnail contentLoadImageFromFile- Loads images with 96px thumbnail size, validates file existenceConvertBitmapSourceToUnoBitmapImage- Converts WPF BitmapSource to Uno BitmapImage via PNG encoding with 8KB pre-allocated bufferWin32 Target Implementation
Win32DragDropExtension.DragEnternow creates aDragUIinstance for external drags (previously null)CreateDragUIForExternalDrag- Creates DragUI with thumbnail content from Win32 formatsExtractFilePathsFromHDrop- Extracts file paths from Win32 HDROP handle using DragQueryFile APIConvertDibToUnoBitmapImage- Converts Win32 DIB format to Uno BitmapImageLoadImageFromFile- Loads images from file system with validationIsImageFile- Detects image files by extensionError Handling (Both Targets)
IOException,UnauthorizedAccessException,NotSupportedException,UriFormatExceptionResource Management (Win32)
PR Checklist ✅
Other information ℹ️
Thumbnails show by default (
CoreDragUIOverride.IsContentVisible = true). Applications can hide them viaDragUIOverridein drag event handlers.This fix applies to both WPF and Win32 Skia rendering backends on Windows Desktop, ensuring consistent drag-and-drop visual feedback across both implementations.
Win32 Implementation Note: The initial implementation had an indexing bug where it assumed
mediumsToDisposealigned withformatEtcList, butmediumsToDisposeonly contains mediums for formats actually retrieved byReadContentIntoPackage. This was fixed by retrieving data directly from the IDataObject when creating the DragUI.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
This is an automatic backport of pull request #21759 done by [Mergify](https://mergify.com).