Skip to content

Commit

Permalink
8130895: Test javax/swing/system/6799345/TestShutdown.java fails on S…
Browse files Browse the repository at this point in the history
…olaris11 Sparcv9

Backport-of: 4140fd05a447c888856c54aee22c475173030833
  • Loading branch information
ktakakuri authored and Paul Hohensee committed Jul 12, 2022
1 parent de9f149 commit 40a1859
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
38 changes: 21 additions & 17 deletions jdk/src/share/classes/java/awt/KeyboardFocusManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +324,6 @@ public static void setCurrentKeyboardFocusManager(
"downCycleDefaultFocusTraversalKeys"
};

/**
* The default strokes for initializing the default focus traversal keys.
*/
private static final AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
{
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK, false),
},
{
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK, false),
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK,
false),
},
{},
{},
};
/**
* The default focus traversal keys. Each array of traversal keys will be
* in effect on all Windows that have no such array of their own explicitly
Expand Down Expand Up @@ -430,6 +413,27 @@ static Set<AWTKeyStroke> initFocusTraversalKeysSet(String value, Set<AWTKeyStrok
* Initializes a KeyboardFocusManager.
*/
public KeyboardFocusManager() {
AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
{
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
InputEvent.CTRL_DOWN_MASK |
InputEvent.CTRL_MASK, false),
},
{
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
InputEvent.SHIFT_DOWN_MASK |
InputEvent.SHIFT_MASK, false),
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
InputEvent.SHIFT_DOWN_MASK |
InputEvent.SHIFT_MASK |
InputEvent.CTRL_DOWN_MASK |
InputEvent.CTRL_MASK,
false),
},
{},
{},
};
for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
Set<AWTKeyStroke> work_set = new HashSet<>();
for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
Expand Down
18 changes: 11 additions & 7 deletions jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag

private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl");

private static AWTAccessor.KeyboardFocusManagerAccessor kfmAccessor =
AWTAccessor.getKeyboardFocusManagerAccessor();
private static class KfmAccessor {
private static AWTAccessor.KeyboardFocusManagerAccessor instance =
AWTAccessor.getKeyboardFocusManagerAccessor();
}

// The constants are copied from java.awt.KeyboardFocusManager
public static final int SNFH_FAILURE = 0;
Expand Down Expand Up @@ -156,12 +158,13 @@ public static int shouldNativelyFocusHeavyweight(Component heavyweight,
long time,
CausedFocusEvent.Cause cause)
{
return kfmAccessor.shouldNativelyFocusHeavyweight(
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
return KfmAccessor.instance.shouldNativelyFocusHeavyweight(
heavyweight, descendant, temporary, focusedWindowChangeAllowed,
time, cause);
}

public static void removeLastFocusRequest(Component heavyweight) {
kfmAccessor.removeLastFocusRequest(heavyweight);
KfmAccessor.instance.removeLastFocusRequest(heavyweight);
}

// WARNING: Don't call it on the Toolkit thread.
Expand All @@ -171,7 +174,8 @@ public static boolean processSynchronousLightweightTransfer(Component heavyweigh
boolean focusedWindowChangeAllowed,
long time)
{
return kfmAccessor.processSynchronousLightweightTransfer(
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
return KfmAccessor.instance.processSynchronousLightweightTransfer(
heavyweight, descendant, temporary, focusedWindowChangeAllowed,
time);
}
}

1 comment on commit 40a1859

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.