On Fri, 22 Oct 2021 17:32:10 GMT, Martin Fox <d...@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.

This pull request has now been integrated.

Changeset: f939d094
Author:    Martin Fox <belden...@users.noreply.github.com>
Committer: Kevin Rushforth <k...@openjdk.org>
URL:       
https://git.openjdk.java.net/jfx/commit/f939d094e3f02575c77a12c3a986d5f601a65a1d
Stats:     87 lines in 3 files changed: 78 ins; 1 del; 8 mod

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

Reviewed-by: pbansal, kcr

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

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

Reply via email to