6907568: java/awt/KeyboardFocusManager.java inproperly merged and lost a changeset
Reapply fix for 6879044 in java.awt.KeyboardFocusManager Reviewed-by: dcherepanov, asaha
This commit is contained in:
parent
45c70cd97e
commit
881a1c5842
@ -53,8 +53,7 @@ import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.HeadlessToolkit;
|
||||
@ -111,7 +110,7 @@ public abstract class KeyboardFocusManager
|
||||
{
|
||||
|
||||
// Shared focus engine logger
|
||||
private static final Logger focusLog = Logger.getLogger("java.awt.focus.KeyboardFocusManager");
|
||||
private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager");
|
||||
|
||||
static {
|
||||
/* ensure that the necessary native libraries are loaded */
|
||||
@ -154,7 +153,7 @@ public abstract class KeyboardFocusManager
|
||||
*/
|
||||
private static native void initIDs();
|
||||
|
||||
private static final Logger log = Logger.getLogger("java.awt.KeyboardFocusManager");
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager");
|
||||
|
||||
/**
|
||||
* The identifier for the Forward focus traversal keys.
|
||||
@ -504,8 +503,8 @@ public abstract class KeyboardFocusManager
|
||||
if (this == getCurrentKeyboardFocusManager()) {
|
||||
return focusOwner;
|
||||
} else {
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
}
|
||||
throw new SecurityException(notPrivileged);
|
||||
}
|
||||
@ -609,9 +608,9 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
|
||||
void setNativeFocusOwner(Component comp) {
|
||||
if (focusLog.isLoggable(Level.FINEST)) {
|
||||
focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}",
|
||||
new Object[] {String.valueOf(peer), String.valueOf(comp)});
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}",
|
||||
String.valueOf(peer), String.valueOf(comp));
|
||||
}
|
||||
peer.setCurrentFocusOwner(comp);
|
||||
}
|
||||
@ -673,8 +672,8 @@ public abstract class KeyboardFocusManager
|
||||
if (this == getCurrentKeyboardFocusManager()) {
|
||||
return permanentFocusOwner;
|
||||
} else {
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
}
|
||||
throw new SecurityException(notPrivileged);
|
||||
}
|
||||
@ -781,8 +780,8 @@ public abstract class KeyboardFocusManager
|
||||
if (this == getCurrentKeyboardFocusManager()) {
|
||||
return focusedWindow;
|
||||
} else {
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
}
|
||||
throw new SecurityException(notPrivileged);
|
||||
}
|
||||
@ -885,8 +884,8 @@ public abstract class KeyboardFocusManager
|
||||
if (this == getCurrentKeyboardFocusManager()) {
|
||||
return activeWindow;
|
||||
} else {
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
}
|
||||
throw new SecurityException(notPrivileged);
|
||||
}
|
||||
@ -919,8 +918,8 @@ public abstract class KeyboardFocusManager
|
||||
Window oldActiveWindow;
|
||||
synchronized (KeyboardFocusManager.class) {
|
||||
oldActiveWindow = getActiveWindow();
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -1215,8 +1214,8 @@ public abstract class KeyboardFocusManager
|
||||
if (this == getCurrentKeyboardFocusManager()) {
|
||||
return currentFocusCycleRoot;
|
||||
} else {
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
|
||||
}
|
||||
throw new SecurityException(notPrivileged);
|
||||
}
|
||||
@ -2149,9 +2148,9 @@ public abstract class KeyboardFocusManager
|
||||
|
||||
HeavyweightFocusRequest(Component heavyweight, Component descendant,
|
||||
boolean temporary, CausedFocusEvent.Cause cause) {
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
if (heavyweight == null) {
|
||||
log.log(Level.FINE, "Assertion (heavyweight != null) failed");
|
||||
log.fine("Assertion (heavyweight != null) failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2161,12 +2160,12 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
boolean addLightweightRequest(Component descendant,
|
||||
boolean temporary, CausedFocusEvent.Cause cause) {
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
|
||||
log.log(Level.FINE, "Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
|
||||
log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
|
||||
}
|
||||
if (descendant == null) {
|
||||
log.log(Level.FINE, "Assertion (descendant != null) failed");
|
||||
log.fine("Assertion (descendant != null) failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2339,12 +2338,12 @@ public abstract class KeyboardFocusManager
|
||||
(Component heavyweight, Component descendant, boolean temporary,
|
||||
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
|
||||
{
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
if (heavyweight == null) {
|
||||
log.log(Level.FINE, "Assertion (heavyweight != null) failed");
|
||||
log.fine("Assertion (heavyweight != null) failed");
|
||||
}
|
||||
if (time == 0) {
|
||||
log.log(Level.FINE, "Assertion (time != 0) failed");
|
||||
log.fine("Assertion (time != 0) failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2361,30 +2360,30 @@ public abstract class KeyboardFocusManager
|
||||
Component currentFocusOwner = thisManager.getGlobalFocusOwner();
|
||||
Component nativeFocusOwner = thisManager.getNativeFocusOwner();
|
||||
Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
focusLog.log(Level.FINER, "SNFH for {0} in {1}",
|
||||
new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)});
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("SNFH for {0} in {1}",
|
||||
String.valueOf(descendant), String.valueOf(heavyweight));
|
||||
}
|
||||
if (focusLog.isLoggable(Level.FINEST)) {
|
||||
focusLog.log(Level.FINEST, "0. Current focus owner {0}",
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("0. Current focus owner {0}",
|
||||
String.valueOf(currentFocusOwner));
|
||||
focusLog.log(Level.FINEST, "0. Native focus owner {0}",
|
||||
focusLog.finest("0. Native focus owner {0}",
|
||||
String.valueOf(nativeFocusOwner));
|
||||
focusLog.log(Level.FINEST, "0. Native focused window {0}",
|
||||
focusLog.finest("0. Native focused window {0}",
|
||||
String.valueOf(nativeFocusedWindow));
|
||||
}
|
||||
synchronized (heavyweightRequests) {
|
||||
HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
|
||||
if (focusLog.isLoggable(Level.FINEST)) {
|
||||
focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest));
|
||||
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(Level.FINEST))
|
||||
focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}",
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
focusLog.finest("1. SNFH_FAILURE for {0}",
|
||||
String.valueOf(descendant));
|
||||
return SNFH_FAILURE;
|
||||
}
|
||||
@ -2417,8 +2416,8 @@ public abstract class KeyboardFocusManager
|
||||
// SunToolkit.postPriorityEvent(newFocusOwnerEvent);
|
||||
SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
|
||||
|
||||
if (focusLog.isLoggable(Level.FINEST))
|
||||
focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant));
|
||||
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) {
|
||||
@ -2431,7 +2430,7 @@ public abstract class KeyboardFocusManager
|
||||
manager.enqueueKeyEvents(time, descendant);
|
||||
}
|
||||
|
||||
if (focusLog.isLoggable(Level.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
focusLog.finest("3. SNFH_HANDLED for lightweight" +
|
||||
descendant + " in " + heavyweight);
|
||||
return SNFH_SUCCESS_HANDLED;
|
||||
@ -2454,7 +2453,7 @@ public abstract class KeyboardFocusManager
|
||||
(hwFocusRequest != null)
|
||||
? hwFocusRequest.heavyweight
|
||||
: nativeFocusedWindow)) {
|
||||
if (focusLog.isLoggable(Level.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
focusLog.finest("4. SNFH_FAILURE for " + descendant);
|
||||
return SNFH_FAILURE;
|
||||
}
|
||||
@ -2464,7 +2463,7 @@ public abstract class KeyboardFocusManager
|
||||
heavyweightRequests.add
|
||||
(new HeavyweightFocusRequest(heavyweight, descendant,
|
||||
temporary, cause));
|
||||
if (focusLog.isLoggable(Level.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
focusLog.finest("5. SNFH_PROCEED for " + descendant);
|
||||
return SNFH_SUCCESS_PROCEED;
|
||||
}
|
||||
@ -2855,14 +2854,14 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
|
||||
KeyboardFocusManager manager = getCurrentKeyboardFocusManager();
|
||||
if (focusLog.isLoggable(Level.FINER)) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
if (event instanceof FocusEvent || event instanceof WindowEvent) {
|
||||
focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
|
||||
focusLog.finer(">>> {0}", String.valueOf(event));
|
||||
}
|
||||
if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) {
|
||||
focusLog.log(Level.FINER, " focus owner is {0}",
|
||||
new Object[] {String.valueOf(manager.getGlobalFocusOwner())});
|
||||
focusLog.log(Level.FINER, ">>> {0}", new Object[] {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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2946,9 +2945,9 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
}
|
||||
static void removeLastFocusRequest(Component heavyweight) {
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
if (heavyweight == null) {
|
||||
log.log(Level.FINE, "Assertion (heavyweight != null) failed");
|
||||
log.fine("Assertion (heavyweight != null) failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user