- Fix issue where End Turn is focused in certain cases (like using targeting through the dev controls)

This commit is contained in:
Sol
2015-05-15 14:42:03 +00:00
parent ff415ab90f
commit 4f5d2da2c2

View File

@@ -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();
}
}
});
}