Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import jds.bibliocraft.gui.GuiBiblioTextField;
import me.eigenraven.lwjgl3ify.client.TextFieldHandler;

@Mixin(value = GuiBiblioTextField.class)
public abstract class BiblioCraftTextField {
Expand All @@ -22,7 +23,8 @@ public abstract class BiblioCraftTextField {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,19 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import betterquesting.client.gui2.GuiQuestSearch;
import betterquesting.client.gui2.editors.GuiQuestLinesEditor;
import betterquesting.client.gui2.editors.GuiTaskEditor;
import betterquesting.client.gui2.editors.nbt.GuiEntitySelection;
import betterquesting.client.gui2.editors.nbt.GuiFluidSelection;
import betterquesting.client.gui2.editors.nbt.GuiNbtAdd;
import bq_standard.client.gui.editors.GuiEditLootGroup;
import bq_standard.client.gui.editors.tasks.GuiEditTaskScoreboard;
import betterquesting.api2.client.gui.GuiScreenCanvas;
import me.eigenraven.lwjgl3ify.client.TextFieldHandler;

@Mixin(
value = { GuiQuestSearch.class, GuiEditLootGroup.class, GuiEditTaskScoreboard.class, GuiEntitySelection.class,
GuiFluidSelection.class, GuiQuestLinesEditor.class, GuiTaskEditor.class, GuiNbtAdd.class })
@Mixin(value = GuiScreenCanvas.class)
public abstract class BqTextInput extends GuiScreen {

@Inject(method = "initPanel()V", at = @At("HEAD"), remap = false)
private void lwjgl3ify$onInit(CallbackInfo ci) {
TextFieldHandler.beginTextInput();
}

@Override
public void onGuiClosed() {
super.onGuiClosed();
@Inject(method = "onGuiClosed()V", at = @At("HEAD"), remap = false)
private void lwjgl3ify$onClose(CallbackInfo ci) {
TextFieldHandler.endTextInput(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class EtfuturumWoodSign {
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ChatAllowedCharacters;isAllowedCharacter(C)Z"),
cancellable = true)
private void lwjgl3ify$fixDoubleChar(char typedChar, int keyCode, CallbackInfo ci) {
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()) {
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import logisticspipes.utils.gui.SearchBar;
import me.eigenraven.lwjgl3ify.client.TextFieldHandler;

@Mixin(value = SearchBar.class)
public abstract class LogisticsPipesTextField {
Expand All @@ -16,7 +17,8 @@ public abstract class LogisticsPipesTextField {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class StevesAddonLabeler {
at = @At(value = "INVOKE", target = "Lstevesaddons/interfaces/GuiTextField;keyTyped(CI)V", remap = false),
cancellable = true)
private void lwjgl3ify$fixDoubleChar(char character, int keyCode, CallbackInfo ci) {
if (Character.isLetterOrDigit(character) && keyCode != 0) {
// Without active text input SDL sends no text events, so the key event is the only source of the character
if (Character.isLetterOrDigit(character) && keyCode != 0 && TextFieldHandler.isTextInputActive()) {
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import me.eigenraven.lwjgl3ify.client.TextFieldHandler;
import vswe.stevesfactory.components.TextBoxLogic;
import vswe.stevesfactory.interfaces.GuiManager;

Expand All @@ -22,7 +23,8 @@ public abstract class StevesFactoryTextField {
remap = false,
cancellable = true)
public void lwjgl3ify$fixDoubleChar(GuiManager gui, char c, int k, CallbackInfo ci) {
if (k != 0) {
// Without active text input SDL sends no text events, so the key event is the only source of the character
if (k != 0 && TextFieldHandler.isTextInputActive()) {
ci.cancel();
}
}
Expand Down
Loading