Merge remote-tracking branch 'origin/GP-1-dragonmacher-focus-fix'

This commit is contained in:
Ryan Kurtz 2024-11-19 12:47:54 -05:00
commit 650c5d8756

View File

@ -1385,6 +1385,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
} }
private synchronized ComponentPlaceholder maybeGetPlaceholderToFocus() { private synchronized ComponentPlaceholder maybeGetPlaceholderToFocus() {
if (nextFocusedPlaceholder != null) { if (nextFocusedPlaceholder != null) {
ComponentPlaceholder temp = nextFocusedPlaceholder; ComponentPlaceholder temp = nextFocusedPlaceholder;
setNextFocusPlaceholder(null); setNextFocusPlaceholder(null);
@ -1392,8 +1393,12 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
} }
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
Component permanentFocusOwner = kfm.getPermanentFocusOwner();
Component focusOwner = kfm.getFocusOwner(); Component focusOwner = kfm.getFocusOwner();
if (focusOwner == null) {
// A null focus owner and a null permanent focus owner imply that Java did not know who
// should get focus. Make sure one of our widgets gets focus.
if (focusOwner == null && permanentFocusOwner == null) {
return findNextFocusedComponent(); return findNextFocusedComponent();
} }
return null; return null;
@ -1463,6 +1468,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
} }
private ComponentPlaceholder findNextFocusedComponent() { private ComponentPlaceholder findNextFocusedComponent() {
Iterator<ComponentPlaceholder> iterator = lastFocusedPlaceholders.iterator(); Iterator<ComponentPlaceholder> iterator = lastFocusedPlaceholders.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ComponentPlaceholder placeholder = iterator.next(); ComponentPlaceholder placeholder = iterator.next();
@ -1471,7 +1477,6 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
} }
iterator.remove(); iterator.remove();
} }
return getActivePlaceholder(defaultProvider); return getActivePlaceholder(defaultProvider);
} }