During a drag-and-drop operation on the Mac the Command key will filter out 
every drag source operation except `NSDragOperationGeneric` (this behavior is 
provided by the OS). JavaFX drag sources only set the Move, Copy, and Link drag 
operation bits so the Command key reduces the set of available operations to 
nothing.

This PR changes nothing about how JavaFX behaves when the dnd operation 
involves an external application. As a drag source the same set of operations 
will be broadcast and as a drag destination the operations will be interpreted 
as they have always been.

For internal dnd within the JavaFX app `NSDragOperationMove` and 
`NSDragOperationGeneric` will both be set if the drag source specifies 
`TransferMode.MOVE`. On the other end a drag destination will interpret 
`NSDragOperationGeneric` and `NSDragOperationMove` as synonyms.

As part of this PR it was necessary to verify that `NSDragOperationGeneric` was 
not already being used during an internal drag operation.  There's a clause in 
`mapJavaMaskToNsOperation:` which translates 
`com_sun_glass_ui_Clipboard_ACTION_ANY` to `NSDragOperationEvery` and this 
includes the Generic bit. I believe this is a red herring, the Java dnd code 
converts `TransferMode.ANY` to a bitwise-OR of COPY, MOVE, and REFERENCE so 
`com_sun_glass_ui_Clipboard_ACTION_ANY` will never be passed down to the 
platform level.

-------------

Commit messages:
 - 8227371 Drag&Drop while holding the CMD key does not work on macOS

Changes: https://git.openjdk.java.net/jfx/pull/651/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=651&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8227371
  Stats: 87 lines in 3 files changed: 78 ins; 1 del; 8 mod
  Patch: https://git.openjdk.java.net/jfx/pull/651.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/651/head:pull/651

PR: https://git.openjdk.java.net/jfx/pull/651

Reply via email to