RFR: 8245575: Show the ContextMenu of input controls with long press gesture on iOS

Jose Pereda jpereda at openjdk.java.net
Mon Jun 8 09:40:24 UTC 2020

On Mon, 8 Jun 2020 09:24:32 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> This PR uses iOS long press gesture to generate a menu event that will trigger a `ContextMenuEvent`.
>> Based on this event, input controls will show the ContextMenu (once JDK-8245499 is fixed), and if required, a developer
>> could add an event handler based on `ContextMenuEvent.CONTEXT_MENU_REQUESTED` for custom processing of such event.
> modules/javafx.graphics/src/main/native-glass/ios/GlassViewDelegate.m line 385:
>> 384:     } else if (sender.state == UIGestureRecognizerStateEnded) {
>> 385:         // Prevent touch ended event
>> 386:         self.mouseTouch = nil;
> no release event needed?

The "right-click" event (enter+right down) is simulated when the long press event is detected
(`UIGestureRecognizerStateBegan `, which happens after 0.5 seconds by default). This will trigger the ContextMenu.

However, the user is still pressing for a few more time. After releasing the tap, (`UIGestureRecognizerStateEnded`),
there is no need of adding a release event (exit+right up), as this will probably will close the ContextMenu. The user
now can select any of the options from the menu, or simply tap elsewhere to close it.


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

More information about the openjfx-dev mailing list