On Sat, 23 Oct 2021 18:20:38 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.
>
> No, my changes won’t fix JDK-8264172. Anything that changes the way JavaFX 
> interacts with external applications like Finder has to go through the Java 
> CSR review process and I wanted to avoid that. I did look into this bug and 
> determined there’s nothing much we can fix.
> 
> When it comes to using the Command key to select Move I discovered that 
> Finder doesn’t respond to Move from another app anyway. Drags from the Finder 
> complete successfully on the drop end but the Finder just ignores the Move. 
> I’m pretty sure this is by design since it conforms with the Apple user 
> interface guidelines.
> 
> You have to use the Control modifier key to select Link when dragging files 
> from the Finder to a JavaFX app. There’s nothing we can do about that, 
> modifier key filtering between applications is handled by the OS and it uses 
> obsolete conventions carried over from NeXTSTEP. And unfortunately given the 
> weird way the OS filters the modifier keys there’s no good work-around.
> 
> By the way, Apple’s online API documentation (in NSDraggingInfo 
> draggingSourceOperationMask) isn’t accurate, it seems to be describing how 
> Finder works internally. There are older documents which describe the OS 
> behavior correctly. I’ve entered a bug against the online docs which I’m sure 
> Apple will ignore.
> 
> Let me know if you want further details on any of this.
> 
>> On Oct 23, 2021, at 3:56 AM, Christoph ***@***.***> wrote:
>> 
>> 
>> Thanks for tackling this issue, much appreciated. I reported a similar one a 
>> while ago https://bugs.openjdk.java.net/browse/JDK-8264172 
>> <https://bugs.openjdk.java.net/browse/JDK-8264172> Can you confirm this will 
>> also be fixed if you drag a file?
>> 
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub 
>> <https://github.com/openjdk/jfx/pull/651#issuecomment-950134569>, or 
>> unsubscribe 
>> <https://github.com/notifications/unsubscribe-auth/AC4G54BWPBFUQKE33NCT323UIKIFHANCNFSM5GRBIDPA>.
>> Triage notifications on the go with GitHub Mobile for iOS 
>> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
>>  or Android 
>> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>>  
>>

@beldenfox this is ready for you to integrate.

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

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

Reply via email to