Add macOS Cocoa drag&drop handler for drop-zone highlight#6181
Conversation
On macOS getDragDropHandler() returned null, so the viewer never received drag enter/over/leave events and the drop-zone highlight never appeared, even though the file drop itself already works through GLFW. Inject the NSDraggingDestination methods into the GLFW content view to emit the existing dragEntranceSignal/dragOverSignal, mirroring the Win32 handler.
|
please fix builds |
check_vcxproj.py requires every .h under source/ to be registered in the matching .vcxproj, which failed the config job: this macOS-only PIMPL header is deliberately not part of the Windows build. Add it to IGNORED_FILENAMES next to the sibling Cocoa headers (MRFileDialogCocoa.h, MRTouchpadCocoaHandler.h).
|
Addressing "please fix builds" — the whole red cascade traced back to a single failing check,
Verified locally (MeshInspector build image): reproduced the check failing on the old head and passing after the fix; compiled the PR's only changed translation unit Not verifiable here: the Objective-C++ |
|
Issue: the drop-zone highlight sometimes stays stuck because the "leave" (
Fix (scoped to
Verification — this can't be exercised on CI (no macOS/AppKit on the runners, and the
|
draggingExited: only fires on a genuine bounds-exit, so it is not guaranteed in every terminal dragging case: an accepted non-file URL drop (GLFW returns YES without firing its drop callback) or a cancelled session (Esc, Mission Control, Space/display switch, source app quitting) left the highlight stuck. Hook draggingEnded: -- sent to the destination at the end of every session -- to also emit dragEntranceSignal(false). The double-clear is idempotent.
|
Addressing the review — agreed, relying on
Verification — consistent with your note, there's no automated check possible here:
|
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Context
On macOS the drop-zone highlight shown while dragging a file over the window never appears, although the file drop itself works. The highlight is driven by the viewer's
dragEntranceSignal/dragOverSignal, emitted by native per-platform handlers — butgetDragDropHandler()returnednullon macOS, so no drag enter/over/leave events ever reached the UI.Changes
MRDragDropCocoaHandler(.hpure-C++ PIMPL +.mmimplementation), modeled onMRTouchpadCocoaHandler: it injectsNSDraggingDestinationmethods into the GLFW content view via the Objective-C runtime.draggingEntered:chains to GLFW's implementation and emitsdragEntranceSignal(true).draggingUpdated:emitsdragOverSignal(x, y), converting the Cocoa location to the top-left-origin, framebuffer-pixel convention used by the Win32/Wasm handlers.draggingExited:emitsdragEntranceSignal(false).performDragOperation:is left untouched, so GLFW keeps delivering the actual drop viadragDropSignal(which also clears the highlight).getDragDropHandler()to return the Cocoa handler under__APPLE__.No CMake /
.vcxprojchanges:*.mmis auto-globbed on Apple and AppKit is already linked; the handler never enters the Windows build.Verification
MRDragDropHandler.cpp) compiles cleanly on the Linux CI image (g++-12 -std=c++20 -fsyntax-only). The Objective-C++.mmis__APPLE__-only, so the macOS build is its first real compile..mmis__APPLE__-guarded), so there is no MCP/automated path to it on this CI.upload-binaries, CI publishes the macOS build — download it and confirm that dragging a file over the window highlights the scene-list and viewport drop zones on enter/move and clears them on leave/drop, and that dropping still loads the file.CI
upload-binaries— to publish the macOS artifact for the manual drag&drop check above.