src/macosx/native/sun/awt/CMenuItem.m

Print this page

        

*** 68,80 **** - (void)handleAction:(NSMenuItem *)sender { AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); ! // If we are called as a result of user pressing a shorcut, do nothing, // because AVTView has already sent corresponding key event to the Java ! // layer from performKeyEquivalent NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; if ([currEvent type] == NSKeyDown) { NSString *menuKey = [sender keyEquivalent]; NSString *eventKey = [currEvent charactersIgnoringModifiers]; --- 68,86 ---- - (void)handleAction:(NSMenuItem *)sender { AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); ! // If we are called as a result of user pressing a shortcut, do nothing, // because AVTView has already sent corresponding key event to the Java ! // layer from performKeyEquivalent. ! // There is an exception from the rule above, though: if a window with ! // a menu gets minimized by user and there are no other windows to take ! // focus, the window's menu won't be removed from the global menu bar. ! // However, the Java layer won't handle invocation by a shortcut coming ! // from this "frameless" menu, because there are no active windows. This ! // means we have to handle it here. NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; if ([currEvent type] == NSKeyDown) { NSString *menuKey = [sender keyEquivalent]; NSString *eventKey = [currEvent charactersIgnoringModifiers];
*** 89,99 **** } eventKey = [NSString stringWithCharacters: &newChar length: 1]; } ! if ([menuKey isEqualToString:eventKey]) { return; } } if (fIsCheckbox) { --- 95,106 ---- } eventKey = [NSString stringWithCharacters: &newChar length: 1]; } ! NSWindow *keyWindow = [NSApp keyWindow]; ! if ([menuKey isEqualToString:eventKey] && keyWindow != nil) { return; } } if (fIsCheckbox) {