RFR: 8227371: Drag&Drop while holding the CMD key does not work on macOS
Christoph
duke at openjdk.java.net
Sat Oct 23 18:28:05 UTC 2021
On Fri, 22 Oct 2021 17:32:10 GMT, Martin Fox <duke at openjdk.java.net> wrote:
> 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.
Thanks for tackling this issue, much appreciated. I reported a similar one a while ago https://bugs.openjdk.java.net/browse/JDK-8264172 Can you confirm this will also be fixed if you drag a file?
-------------
PR: https://git.openjdk.java.net/jfx/pull/651
More information about the openjfx-dev
mailing list