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

Print this page

        

*** 308,318 **** * @param e the AWTEvent to be dispatched * @return <code>true</code> if this method dispatched the event; * <code>false</code> otherwise */ public boolean dispatchEvent(AWTEvent e) { ! if (focusLog.isLoggable(PlatformLogger.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) { focusLog.fine("" + e); } switch (e.getID()) { case WindowEvent.WINDOW_GAINED_FOCUS: { if (repostIfFollowsKeyEvents((WindowEvent)e)) { --- 308,318 ---- * @param e the AWTEvent to be dispatched * @return <code>true</code> if this method dispatched the event; * <code>false</code> otherwise */ public boolean dispatchEvent(AWTEvent e) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) { focusLog.fine("" + e); } switch (e.getID()) { case WindowEvent.WINDOW_GAINED_FOCUS: { if (repostIfFollowsKeyEvents((WindowEvent)e)) {
*** 417,427 **** tempLost = newFocusedWindow.setTemporaryLostComponent(null); } // The component which last has the focus when this window was focused // should receive focus first ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("tempLost {0}, toFocus {1}", tempLost, toFocus); } if (tempLost != null) { tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION); --- 417,427 ---- tempLost = newFocusedWindow.setTemporaryLostComponent(null); } // The component which last has the focus when this window was focused // should receive focus first ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("tempLost {0}, toFocus {1}", tempLost, toFocus); } if (tempLost != null) { tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION);
*** 486,496 **** CausedFocusEvent.Cause cause = (fe instanceof CausedFocusEvent) ? ((CausedFocusEvent)fe).getCause() : CausedFocusEvent.Cause.UNKNOWN; Component oldFocusOwner = getGlobalFocusOwner(); Component newFocusOwner = fe.getComponent(); if (oldFocusOwner == newFocusOwner) { ! if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine("Skipping {0} because focus owner is the same", e); } // We can't just drop the event - there could be // type-ahead markers associated with it. dequeueKeyEvents(-1, newFocusOwner); --- 486,496 ---- CausedFocusEvent.Cause cause = (fe instanceof CausedFocusEvent) ? ((CausedFocusEvent)fe).getCause() : CausedFocusEvent.Cause.UNKNOWN; Component oldFocusOwner = getGlobalFocusOwner(); Component newFocusOwner = fe.getComponent(); if (oldFocusOwner == newFocusOwner) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) { focusLog.fine("Skipping {0} because focus owner is the same", e); } // We can't just drop the event - there could be // type-ahead markers associated with it. dequeueKeyEvents(-1, newFocusOwner);
*** 604,622 **** case FocusEvent.FOCUS_LOST: { FocusEvent fe = (FocusEvent)e; Component currentFocusOwner = getGlobalFocusOwner(); if (currentFocusOwner == null) { ! if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Skipping {0} because focus owner is null", e); break; } // Ignore cases where a Component loses focus to itself. // If we make a mistake because of retargeting, then the // FOCUS_GAINED handler will correct it. if (currentFocusOwner == fe.getOppositeComponent()) { ! if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Skipping {0} because current focus owner is equal to opposite", e); break; } setGlobalFocusOwner(null); --- 604,622 ---- case FocusEvent.FOCUS_LOST: { FocusEvent fe = (FocusEvent)e; Component currentFocusOwner = getGlobalFocusOwner(); if (currentFocusOwner == null) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) focusLog.fine("Skipping {0} because focus owner is null", e); break; } // Ignore cases where a Component loses focus to itself. // If we make a mistake because of retargeting, then the // FOCUS_GAINED handler will correct it. if (currentFocusOwner == fe.getOppositeComponent()) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) focusLog.fine("Skipping {0} because current focus owner is equal to opposite", e); break; } setGlobalFocusOwner(null);
*** 685,695 **** WindowEvent we = (WindowEvent)e; Window currentFocusedWindow = getGlobalFocusedWindow(); Window losingFocusWindow = we.getWindow(); Window activeWindow = getGlobalActiveWindow(); Window oppositeWindow = we.getOppositeWindow(); ! if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Active {0}, Current focused {1}, losing focus {2} opposite {3}", activeWindow, currentFocusedWindow, losingFocusWindow, oppositeWindow); if (currentFocusedWindow == null) { break; --- 685,695 ---- WindowEvent we = (WindowEvent)e; Window currentFocusedWindow = getGlobalFocusedWindow(); Window losingFocusWindow = we.getWindow(); Window activeWindow = getGlobalActiveWindow(); Window oppositeWindow = we.getOppositeWindow(); ! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) focusLog.fine("Active {0}, Current focused {1}, losing focus {2} opposite {3}", activeWindow, currentFocusedWindow, losingFocusWindow, oppositeWindow); if (currentFocusedWindow == null) { break;
*** 871,881 **** if (ke.getWhen() > marker.after) { ke = null; } } if (ke != null) { ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Pumping approved event {0}", ke); } enqueuedKeyEvents.removeFirst(); } } --- 871,881 ---- if (ke.getWhen() > marker.after) { ke = null; } } if (ke != null) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Pumping approved event {0}", ke); } enqueuedKeyEvents.removeFirst(); } }
*** 888,898 **** /** * Dumps the list of type-ahead queue markers to stderr */ void dumpMarkers() { ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest(">>> Markers dump, time: {0}", System.currentTimeMillis()); synchronized (this) { if (typeAheadMarkers.size() != 0) { Iterator<TypeAheadMarker> iter = typeAheadMarkers.iterator(); while (iter.hasNext()) { --- 888,898 ---- /** * Dumps the list of type-ahead queue markers to stderr */ void dumpMarkers() { ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest(">>> Markers dump, time: {0}", System.currentTimeMillis()); synchronized (this) { if (typeAheadMarkers.size() != 0) { Iterator<TypeAheadMarker> iter = typeAheadMarkers.iterator(); while (iter.hasNext()) {
*** 922,932 **** // Fixed 5064013: may appears that the events have the same time // if (ke.getWhen() >= marker.after) { // The fix is rolled out. if (ke.getWhen() > marker.after) { ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Storing event {0} because of marker {1}", ke, marker); } enqueuedKeyEvents.addLast(ke); return true; } --- 922,932 ---- // Fixed 5064013: may appears that the events have the same time // if (ke.getWhen() >= marker.after) { // The fix is rolled out. if (ke.getWhen() > marker.after) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Storing event {0} because of marker {1}", ke, marker); } enqueuedKeyEvents.addLast(ke); return true; }
*** 936,946 **** // KeyEvent was posted before focus change request return preDispatchKeyEvent(ke); } case FocusEvent.FOCUS_GAINED: ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("Markers before FOCUS_GAINED on {0}", target); } dumpMarkers(); // Search the marker list for the first marker tied to // the Component which just gained focus. Then remove --- 936,946 ---- // KeyEvent was posted before focus change request return preDispatchKeyEvent(ke); } case FocusEvent.FOCUS_GAINED: ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("Markers before FOCUS_GAINED on {0}", target); } dumpMarkers(); // Search the marker list for the first marker tied to // the Component which just gained focus. Then remove
*** 965,975 **** } iter.remove(); } } else { // Exception condition - event without marker ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Event without marker {0}", e); } } } focusLog.finest("Markers after FOCUS_GAINED"); --- 965,975 ---- } iter.remove(); } } else { // Exception condition - event without marker ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Event without marker {0}", e); } } } focusLog.finest("Markers after FOCUS_GAINED");
*** 1206,1216 **** Component untilFocused) { if (untilFocused == null) { return; } ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Enqueue at {0} for {1}", after, untilFocused); } int insertionIndex = 0, --- 1206,1216 ---- Component untilFocused) { if (untilFocused == null) { return; } ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Enqueue at {0} for {1}", after, untilFocused); } int insertionIndex = 0,
*** 1248,1258 **** Component untilFocused) { if (untilFocused == null) { return; } ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Dequeue at {0} for {1}", after, untilFocused); } TypeAheadMarker marker; --- 1248,1258 ---- Component untilFocused) { if (untilFocused == null) { return; } ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Dequeue at {0} for {1}", after, untilFocused); } TypeAheadMarker marker;