Fix typing in BetterQuesting text fields on unlisted screens (#391)

This commit is contained in:
micvog authored and GitHub committed 2026-11-03 09:33:40 +01:00
1 parent 9de770ffe6
commit b2545808e6
2 files changed
+7 -1

No files matched your search

@@ -26,6 +26,10 @@ public final class TextFieldHandler {
private static WeakReference<GuiTextField> focusedTextInput = NULL_TEXT_FIELD;
public static final StringBuilder textBuffer = new StringBuilder(8);
public static boolean isTextInputActive() {
return textInputDepth > 0;
}
public static void beginTextInput() {
if (textInputDepth == Integer.MAX_VALUE) {
return;
@@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import betterquesting.api2.client.gui.controls.PanelTextField;
import me.eigenraven.lwjgl3ify.client.TextFieldHandler;
@Mixin(value = PanelTextField.class)
public abstract class BqPanelTextField {
@@ -22,7 +23,8 @@ public abstract class BqPanelTextField {
remap = false,
cancellable = true)
public void lwjgl3ify$fixDoubleChar(char typedChar, int keyCode, CallbackInfoReturnable<Boolean> cir) {
if (keyCode != 0) {
// Without active text input SDL sends no text events, so the key event is the only source of the character
if (keyCode != 0 && TextFieldHandler.isTextInputActive()) {
cir.setReturnValue(true);
}
}