src/share/classes/java/awt/KeyboardFocusManager.java

Print this page

        

*** 650,660 **** Component getNativeFocusOwner() { return peer.getCurrentFocusOwner(); } void setNativeFocusOwner(Component comp) { ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}", String.valueOf(peer), String.valueOf(comp)); } peer.setCurrentFocusOwner(comp); } --- 650,660 ---- Component getNativeFocusOwner() { return peer.getCurrentFocusOwner(); } void setNativeFocusOwner(Component comp) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}", String.valueOf(peer), String.valueOf(comp)); } peer.setCurrentFocusOwner(comp); }
*** 959,969 **** Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { checkKFMSecurity(); oldActiveWindow = getActiveWindow(); ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); } try { fireVetoableChange("activeWindow", oldActiveWindow, --- 959,969 ---- Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { checkKFMSecurity(); oldActiveWindow = getActiveWindow(); ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); } try { fireVetoableChange("activeWindow", oldActiveWindow,
*** 2194,2204 **** lightweightRequests = null; } HeavyweightFocusRequest(Component heavyweight, Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } } --- 2194,2204 ---- lightweightRequests = null; } HeavyweightFocusRequest(Component heavyweight, Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } }
*** 2206,2216 **** this.lightweightRequests = new LinkedList<LightweightFocusRequest>(); addLightweightRequest(descendant, temporary, cause); } boolean addLightweightRequest(Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.FINE)) { if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) { log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed"); } if (descendant == null) { log.fine("Assertion (descendant != null) failed"); --- 2206,2216 ---- this.lightweightRequests = new LinkedList<LightweightFocusRequest>(); addLightweightRequest(descendant, temporary, cause); } boolean addLightweightRequest(Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) { log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed"); } if (descendant == null) { log.fine("Assertion (descendant != null) failed");
*** 2384,2394 **** */ static int shouldNativelyFocusHeavyweight (Component heavyweight, Component descendant, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } if (time == 0) { log.fine("Assertion (time != 0) failed"); --- 2384,2394 ---- */ static int shouldNativelyFocusHeavyweight (Component heavyweight, Component descendant, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } if (time == 0) { log.fine("Assertion (time != 0) failed");
*** 2406,2438 **** getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); KeyboardFocusManager thisManager = getCurrentKeyboardFocusManager(); Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); ! if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("SNFH for {0} in {1}", String.valueOf(descendant), String.valueOf(heavyweight)); } ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("0. Current focus owner {0}", String.valueOf(currentFocusOwner)); focusLog.finest("0. Native focus owner {0}", String.valueOf(nativeFocusOwner)); focusLog.finest("0. Native focused window {0}", String.valueOf(nativeFocusedWindow)); } synchronized (heavyweightRequests) { HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("Request {0}", String.valueOf(hwFocusRequest)); } if (hwFocusRequest == null && heavyweight == nativeFocusOwner) { if (descendant == currentFocusOwner) { // Redundant request. ! if (focusLog.isLoggable(PlatformLogger.FINEST)) focusLog.finest("1. SNFH_FAILURE for {0}", String.valueOf(descendant)); return SNFH_FAILURE; } --- 2406,2438 ---- getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); KeyboardFocusManager thisManager = getCurrentKeyboardFocusManager(); Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { focusLog.finer("SNFH for {0} in {1}", String.valueOf(descendant), String.valueOf(heavyweight)); } ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("0. Current focus owner {0}", String.valueOf(currentFocusOwner)); focusLog.finest("0. Native focus owner {0}", String.valueOf(nativeFocusOwner)); focusLog.finest("0. Native focused window {0}", String.valueOf(nativeFocusedWindow)); } synchronized (heavyweightRequests) { HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("Request {0}", String.valueOf(hwFocusRequest)); } if (hwFocusRequest == null && heavyweight == nativeFocusOwner) { if (descendant == currentFocusOwner) { // Redundant request. ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) focusLog.finest("1. SNFH_FAILURE for {0}", String.valueOf(descendant)); return SNFH_FAILURE; }
*** 2462,2472 **** temporary, currentFocusOwner, cause); // Fix 5028014. Rolled out. // SunToolkit.postPriorityEvent(newFocusOwnerEvent); SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); ! if (focusLog.isLoggable(PlatformLogger.FINEST)) focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant)); return SNFH_SUCCESS_HANDLED; } else if (hwFocusRequest != null && hwFocusRequest.heavyweight == heavyweight) { // 'heavyweight' doesn't have the native focus right now, but --- 2462,2472 ---- temporary, currentFocusOwner, cause); // Fix 5028014. Rolled out. // SunToolkit.postPriorityEvent(newFocusOwnerEvent); SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant)); return SNFH_SUCCESS_HANDLED; } else if (hwFocusRequest != null && hwFocusRequest.heavyweight == heavyweight) { // 'heavyweight' doesn't have the native focus right now, but
*** 2476,2486 **** if (hwFocusRequest.addLightweightRequest(descendant, temporary, cause)) { manager.enqueueKeyEvents(time, descendant); } ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("3. SNFH_HANDLED for lightweight" + descendant + " in " + heavyweight); } return SNFH_SUCCESS_HANDLED; } else { --- 2476,2486 ---- if (hwFocusRequest.addLightweightRequest(descendant, temporary, cause)) { manager.enqueueKeyEvents(time, descendant); } ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("3. SNFH_HANDLED for lightweight" + descendant + " in " + heavyweight); } return SNFH_SUCCESS_HANDLED; } else {
*** 2500,2510 **** } if (focusedWindowChanged(heavyweight, (hwFocusRequest != null) ? hwFocusRequest.heavyweight : nativeFocusedWindow)) { ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("4. SNFH_FAILURE for " + descendant); } return SNFH_FAILURE; } } --- 2500,2510 ---- } if (focusedWindowChanged(heavyweight, (hwFocusRequest != null) ? hwFocusRequest.heavyweight : nativeFocusedWindow)) { ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("4. SNFH_FAILURE for " + descendant); } return SNFH_FAILURE; } }
*** 2511,2521 **** manager.enqueueKeyEvents(time, descendant); heavyweightRequests.add (new HeavyweightFocusRequest(heavyweight, descendant, temporary, cause)); ! if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("5. SNFH_PROCEED for " + descendant); } return SNFH_SUCCESS_PROCEED; } } --- 2511,2521 ---- manager.enqueueKeyEvents(time, descendant); heavyweightRequests.add (new HeavyweightFocusRequest(heavyweight, descendant, temporary, cause)); ! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("5. SNFH_PROCEED for " + descendant); } return SNFH_SUCCESS_PROCEED; } }
*** 2903,2917 **** if (clearingCurrentLightweightRequests) { return event; } KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); ! if (focusLog.isLoggable(PlatformLogger.FINER)) { if (event instanceof FocusEvent || event instanceof WindowEvent) { focusLog.finer(">>> {0}", String.valueOf(event)); } ! if (focusLog.isLoggable(PlatformLogger.FINER) && event instanceof KeyEvent) { focusLog.finer(" focus owner is {0}", String.valueOf(manager.getGlobalFocusOwner())); focusLog.finer(">>> {0}", String.valueOf(event)); } } --- 2903,2917 ---- if (clearingCurrentLightweightRequests) { return event; } KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); ! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { if (event instanceof FocusEvent || event instanceof WindowEvent) { focusLog.finer(">>> {0}", String.valueOf(event)); } ! if (focusLog.isLoggable(PlatformLogger.Level.FINER) && event instanceof KeyEvent) { focusLog.finer(" focus owner is {0}", String.valueOf(manager.getGlobalFocusOwner())); focusLog.finer(">>> {0}", String.valueOf(event)); } }
*** 2994,3004 **** } return (heavyweightRequests.size() > 0); } } static void removeLastFocusRequest(Component heavyweight) { ! if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } } --- 2994,3004 ---- } return (heavyweightRequests.size() > 0); } } static void removeLastFocusRequest(Component heavyweight) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { if (heavyweight == null) { log.fine("Assertion (heavyweight != null) failed"); } }