changeset 7233:30b24988ef50

RT-36361: [Accessibility] Mac: context menu hot key not working Summary: Don't use menuForEvent: and always synthesize the menu event instead Reviewed-by: fheidric
author Anthony Petrov <anthony.petrov@oracle.com>
date Tue, 10 Jun 2014 21:17:19 +0400
parents da52f6e7f012
children d10817fc3844
files modules/graphics/src/main/native-glass/mac/GlassView3D.m modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/mac/GlassView3D.m	Mon Jun 09 15:28:01 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassView3D.m	Tue Jun 10 21:17:19 2014 +0400
@@ -330,12 +330,6 @@
     [self->_delegate updateTrackingAreas];
 }
 
-- (NSMenu *)menuForEvent:(NSEvent *)theEvent
-{
-    [self->_delegate sendJavaMenuEvent:theEvent];
-    return [super menuForEvent: theEvent];
-}
-
 - (void)mouseEntered:(NSEvent *)theEvent
 {
     MOUSELOG("mouseEntered");
@@ -383,10 +377,9 @@
 {
     MOUSELOG("rightMouseDown");
     [self->_delegate sendJavaMouseEvent:theEvent];
-    // By default, calling rightMouseDown: generates menuForEvent: but none of the other glass mouse handlers call the super
-    // To be consistent with the rest of glass, call the menu event handler directly rather than letting the operating system do it
-    [self->_delegate sendJavaMenuEvent:theEvent];
-//    return [super rightMouseDown: theEvent];
+    // NOTE: menuForEvent: is invoked differently for right-click
+    // and Ctrl+Click actions. So instead we always synthesize
+    // the menu event in Glass. See sendJavaMouseEvent for details.
 }
 
 - (void)rightMouseDragged:(NSEvent *)theEvent
--- a/modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m	Mon Jun 09 15:28:01 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m	Tue Jun 10 21:17:19 2014 +0400
@@ -578,6 +578,10 @@
                     modifiers, isPopupTrigger, isSynthesized);
         }
         GLASS_CHECK_EXCEPTION(env);
+
+        if (isPopupTrigger) {
+            [self sendJavaMenuEvent:theEvent];
+        }
     }
 }