< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 26,35 ****
--- 26,36 ----
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#include <Carbon/Carbon.h>
#import "CMenuItem.h"
#import "CMenu.h"
#import "AWTEvent.h"
+ #import "AWTWindow.h"
#import "ThreadUtilities.h"
#import "java_awt_Event.h"
#import "java_awt_event_KeyEvent.h"
#import "sun_lwawt_macosx_CMenuItem.h"
*** 109,120 ****
if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) {
newChar = origChar;
}
eventKey = [NSString stringWithCharacters: &newChar length: 1];
}
NSWindow *keyWindow = [NSApp keyWindow];
! if (keyWindow != nil) {
return;
}
}
static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem");
--- 110,123 ----
if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) {
newChar = origChar;
}
eventKey = [NSString stringWithCharacters: &newChar length: 1];
}
+ // The action event can be ignored only if the key window is an AWT window.
+ // Otherwise, the action event is the only notification and must be processed.
NSWindow *keyWindow = [NSApp keyWindow];
! if (keyWindow != nil && [AWTWindow isAWTWindow: keyWindow]) {
return;
}
}
static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem");
< prev index next >