fix: Add DragUI support for external drag operations on Windows (Skia/WPF and Skia/Win32)#21759
Conversation
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
|
|
@copilot please implement this for Win32 target as well |
Implemented in commit efe66dc. The Win32 target now has the same DragUI support for external drag operations, including:
The implementation follows the same pattern as the WPF target but uses Win32 APIs to extract bitmap data from HGLOBAL handles. |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
@copilot It does not seem to work on Win32, CreateDragUIForExternalDrag |
Fixed in commit c705ac5. The issue was that The fix retrieves data directly from the IDataObject when creating DragUI, properly managing STGMEDIUM lifecycle with try-finally blocks for cleanup. This eliminates the dependency on the indexed medium list. |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
|
|
@Mergifyio backport release/stable/6.4 |
✅ Backports have been createdDetails
|
ab93438 to
b098e35
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
The build 184695 found UI Test snapshots differences: Details
|
…xtension Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
…pExtension Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
…tion Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
b098e35 to
b5e891f
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21759/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
5a27f3d to
0d6eeec
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21759/wasm-skia-net9/index.html |
|
The build 185097 found UI Test snapshots differences: Details
|
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.