src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java
Print this page
*** 29,38 ****
--- 29,40 ----
import java.awt.Container;
import java.awt.Event;
import java.awt.KeyEventPostProcessor;
import java.awt.Window;
import java.awt.Toolkit;
+
+ import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
*** 131,144 ****
// with a reasonable delay since it has been generated.
// Here we check the last deactivation time of the containing
// window. If this time appears to be greater than the altRelease
// event time the event is skipped to avoid unexpected menu
// activation. See 7121442.
boolean skip = false;
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
! skip = ev.getWhen() <= ((SunToolkit)tk).getWindowDeactivationTime(winAncestor);
}
if (menu != null && !skip) {
MenuElement[] path = new MenuElement[2];
path[0] = mbar;
--- 133,151 ----
// with a reasonable delay since it has been generated.
// Here we check the last deactivation time of the containing
// window. If this time appears to be greater than the altRelease
// event time the event is skipped to avoid unexpected menu
// activation. See 7121442.
+ // Also we must ensure that original source of key event belongs
+ // to the same window object as winAncestor. See 8001633.
boolean skip = false;
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
! Component originalSource = AWTAccessor.getKeyEventAccessor()
! .getOriginalSource(ev);
! skip = ev.getWhen() <= ((SunToolkit) tk).getWindowDeactivationTime(winAncestor)
! || SunToolkit.getContainingWindow(originalSource) != winAncestor;
}
if (menu != null && !skip) {
MenuElement[] path = new MenuElement[2];
path[0] = mbar;