mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Fix issue where End Turn is focused in certain cases (like using targeting through the dev controls)
This commit is contained in:
@@ -556,15 +556,24 @@ public final class CMatchUI
|
||||
final FButton btn1 = view.getBtnOK(), btn2 = view.getBtnCancel();
|
||||
btn1.setText(label1);
|
||||
btn2.setText(label2);
|
||||
|
||||
// Remove focusable so the right button grabs focus properly
|
||||
btn1.setFocusable(false);
|
||||
btn2.setFocusable(false);
|
||||
|
||||
btn1.setEnabled(enable1);
|
||||
btn2.setEnabled(enable2);
|
||||
|
||||
final FButton toFocus = enable1 && focus1 ? btn1 : (enable2 ? btn2 : null);
|
||||
// ensure we don't steal focus from an overlay
|
||||
if (toFocus != null && !SOverlayUtils.overlayHasFocus()) {
|
||||
if (toFocus != null) {
|
||||
FThreads.invokeInEdtLater(new Runnable() {
|
||||
@Override public final void run() {
|
||||
toFocus.requestFocusInWindow();
|
||||
btn1.setFocusable(true);
|
||||
btn2.setFocusable(true);
|
||||
if (!SOverlayUtils.overlayHasFocus()) {
|
||||
toFocus.requestFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user