Fix repeated key events not getting handled in search boxes (#1784)

GUIs are supposed to call enableRepeatEvents() from initGui() and
onGuiClosed() to properly handle repeated key events.  This change
adds the appropriate calls in GuiBase.

See the equivalent code in eg. Applied Energistics 2:
cc9b33b473/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java (L224)
cc9b33b473/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java (L399)

Fixes https://github.com/raoulvdberge/refinedstorage/issues/1762
This commit is contained in:
tomKPZ
2018-05-12 22:17:00 -07:00
committed by Raoul
parent 16cf3077c8
commit f5b6357b1c
2 changed files with 11 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.client.config.GuiCheckBox;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.items.SlotItemHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import javax.annotation.Nonnull;
@@ -101,6 +103,8 @@ public abstract class GuiBase extends GuiContainer {
initializing = true;
Keyboard.enableRepeatEvents(true);
calcHeight();
super.initGui();
@@ -117,6 +121,12 @@ public abstract class GuiBase extends GuiContainer {
initializing = false;
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}
protected void calcHeight() {
}