src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java

Print this page

        

*** 228,238 **** * Sends a synthetic AWTEvent to a Component. If the Component is in * the current AppContext, then the event is immediately dispatched. * If the Component is in a different AppContext, then the event is * posted to the other AppContext's EventQueue, and this method blocks * until the event is handled or target AppContext is disposed. ! * Returns true if successfuly dispatched event, false if failed * to dispatch. */ static boolean sendMessage(Component target, AWTEvent e) { e.isPosted = true; AppContext myAppContext = AppContext.getAppContext(); --- 228,238 ---- * Sends a synthetic AWTEvent to a Component. If the Component is in * the current AppContext, then the event is immediately dispatched. * If the Component is in a different AppContext, then the event is * posted to the other AppContext's EventQueue, and this method blocks * until the event is handled or target AppContext is disposed. ! * Returns true if successfully dispatched event, false if failed * to dispatch. */ static boolean sendMessage(Component target, AWTEvent e) { e.isPosted = true; AppContext myAppContext = AppContext.getAppContext();
*** 347,357 **** boolean isEventDispatched = sendMessage(oldFocusedWindow, new WindowEvent(oldFocusedWindow, WindowEvent.WINDOW_LOST_FOCUS, newFocusedWindow)); ! // Failed to dispatch, clear by ourselfves if (!isEventDispatched) { setGlobalFocusOwner(null); setGlobalFocusedWindow(null); } } --- 347,357 ---- boolean isEventDispatched = sendMessage(oldFocusedWindow, new WindowEvent(oldFocusedWindow, WindowEvent.WINDOW_LOST_FOCUS, newFocusedWindow)); ! // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalFocusOwner(null); setGlobalFocusedWindow(null); } }
*** 464,474 **** boolean isEventDispatched = sendMessage(oldActiveWindow, new WindowEvent(oldActiveWindow, WindowEvent.WINDOW_DEACTIVATED, newActiveWindow)); ! // Failed to dispatch, clear by ourselfves if (!isEventDispatched) { setGlobalActiveWindow(null); } if (getGlobalActiveWindow() != null) { // Activation change was rejected. Unlikely, but --- 464,474 ---- boolean isEventDispatched = sendMessage(oldActiveWindow, new WindowEvent(oldActiveWindow, WindowEvent.WINDOW_DEACTIVATED, newActiveWindow)); ! // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalActiveWindow(null); } if (getGlobalActiveWindow() != null) { // Activation change was rejected. Unlikely, but
*** 511,521 **** sendMessage(oldFocusOwner, new CausedFocusEvent(oldFocusOwner, FocusEvent.FOCUS_LOST, fe.isTemporary(), newFocusOwner, cause)); ! // Failed to dispatch, clear by ourselfves if (!isEventDispatched) { setGlobalFocusOwner(null); if (!fe.isTemporary()) { setGlobalPermanentFocusOwner(null); } --- 511,521 ---- sendMessage(oldFocusOwner, new CausedFocusEvent(oldFocusOwner, FocusEvent.FOCUS_LOST, fe.isTemporary(), newFocusOwner, cause)); ! // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalFocusOwner(null); if (!fe.isTemporary()) { setGlobalPermanentFocusOwner(null); }
*** 747,757 **** ? new WeakReference<Window>(currentFocusedWindow) : NULL_WINDOW_WR; typeAheadAssertions(currentFocusedWindow, we); if (oppositeWindow == null) { ! // Then we need to deactive the active Window as well. // No need to synthesize in other cases, because // WINDOW_ACTIVATED will handle it if necessary. sendMessage(activeWindow, new WindowEvent(activeWindow, WindowEvent.WINDOW_DEACTIVATED, --- 747,757 ---- ? new WeakReference<Window>(currentFocusedWindow) : NULL_WINDOW_WR; typeAheadAssertions(currentFocusedWindow, we); if (oppositeWindow == null) { ! // Then we need to deactivate the active Window as well. // No need to synthesize in other cases, because // WINDOW_ACTIVATED will handle it if necessary. sendMessage(activeWindow, new WindowEvent(activeWindow, WindowEvent.WINDOW_DEACTIVATED,
*** 952,962 **** dumpMarkers(); // Search the marker list for the first marker tied to // the Component which just gained focus. Then remove // that marker, any markers which immediately follow // and are tied to the same component, and all markers ! // that preceed it. This handles the case where // multiple focus requests were made for the same // Component in a row and when we lost some of the // earlier requests. Since FOCUS_GAINED events will // not be generated for these additional requests, we // need to clear those markers too. --- 952,962 ---- dumpMarkers(); // Search the marker list for the first marker tied to // the Component which just gained focus. Then remove // that marker, any markers which immediately follow // and are tied to the same component, and all markers ! // that precede it. This handles the case where // multiple focus requests were made for the same // Component in a row and when we lost some of the // earlier requests. Since FOCUS_GAINED events will // not be generated for these additional requests, we // need to clear those markers too.