1 /* |
1 /* |
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
30 import java.awt.peer.ComponentPeer; |
30 import java.awt.peer.ComponentPeer; |
31 import java.awt.peer.LightweightPeer; |
31 import java.awt.peer.LightweightPeer; |
32 import java.lang.ref.WeakReference; |
32 import java.lang.ref.WeakReference; |
33 import java.security.AccessController; |
33 import java.security.AccessController; |
34 import java.security.PrivilegedAction; |
34 import java.security.PrivilegedAction; |
|
35 import java.util.Iterator; |
35 import java.util.LinkedList; |
36 import java.util.LinkedList; |
36 import java.util.Iterator; |
|
37 import java.util.ListIterator; |
37 import java.util.ListIterator; |
38 import java.util.Set; |
38 import java.util.Set; |
39 |
39 |
40 import sun.util.logging.PlatformLogger; |
40 import sun.awt.AWTAccessor; |
41 |
|
42 import sun.awt.AppContext; |
41 import sun.awt.AppContext; |
43 import sun.awt.SunToolkit; |
42 import sun.awt.SunToolkit; |
44 import sun.awt.AWTAccessor; |
|
45 import sun.awt.TimedWindowEvent; |
43 import sun.awt.TimedWindowEvent; |
|
44 import sun.util.logging.PlatformLogger; |
46 |
45 |
47 /** |
46 /** |
48 * The default KeyboardFocusManager for AWT applications. Focus traversal is |
47 * The default KeyboardFocusManager for AWT applications. Focus traversal is |
49 * done in response to a Component's focus traversal keys, and using a |
48 * done in response to a Component's focus traversal keys, and using a |
50 * Container's FocusTraversalPolicy. |
49 * Container's FocusTraversalPolicy. |
811 realOppositeWindowWR = (oppositeWindow != null) |
810 realOppositeWindowWR = (oppositeWindow != null) |
812 ? new WeakReference<Window>(currentFocusedWindow) |
811 ? new WeakReference<Window>(currentFocusedWindow) |
813 : NULL_WINDOW_WR; |
812 : NULL_WINDOW_WR; |
814 typeAheadAssertions(currentFocusedWindow, we); |
813 typeAheadAssertions(currentFocusedWindow, we); |
815 |
814 |
816 if (oppositeWindow == null) { |
815 if (oppositeWindow == null && activeWindow != null) { |
817 // Then we need to deactivate the active Window as well. |
816 // Then we need to deactivate the active Window as well. |
818 // No need to synthesize in other cases, because |
817 // No need to synthesize in other cases, because |
819 // WINDOW_ACTIVATED will handle it if necessary. |
818 // WINDOW_ACTIVATED will handle it if necessary. |
820 sendMessage(activeWindow, |
819 sendMessage(activeWindow, |
821 new WindowEvent(activeWindow, |
820 new WindowEvent(activeWindow, |