0
votes

When I drag an NSTableView (view based) item over the dock, the dock freezes. I.e. it does the genie effect when entering the Dock area, but then it is just stuck.

I've implemented:

func tableView(_ tv: NSTableView, pasteboardWriterForRow row: Int)
     -> NSPasteboardWriting?

to make the row draggable, it is returning an own NSObject implementing NSPasteboardWriting, nothing special really (declares a string and a custom type).

Also D&D is working just fine within the app. It is just for outside drags, when it starts to fail.

Q: Any idea what I may be doing wrong? :-)

Sample code: https://gist.github.com/helje5/48728983951ab3362af43b967c554475

P.S.: I also have a custom view implementing NSDraggingSource itself, and that seems to work just fine.

Demo GIF

1
Please post a mcve.Willeke
I tried your code but I can't drop. How do you get the genie effect, do you drop on a minimized window?Willeke
I get the genie effect by enabling that in the Preferences/Dock :-) The issue is unrelated to the actual dropping of the dragged item. (you can drag the labels, right?) You drag the item over the Dock, then the Dock "genies" (increases the icon size at the point where the drag enters the dog), but it sticks there. It feels like the event loop is stuck for some reason. Always repro's for me. (for now I solved it by not using NSTableView DnD, but by initiating the drag session in the cell view itself.hnh
Do you call tableView.setDraggingSourceOperationMask?Willeke

1 Answers

1
votes

When an item which can't be dropped outside the app is dragged over the Dock then the animation of the Dock freezes. Call

func setDraggingSourceOperationMask(_ mask: NSDragOperation, forLocal isLocal: Bool)

with forLocal is false to make the item droppable outside the app.