From fa5491e7f925e24928a109045d7971fd470fd282 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Thu, 14 Nov 2024 00:13:47 +0100 Subject: [PATCH] fix changing size of the interface terminal switching to a different GUI entirely --- .../github/client/gui/GuiInterfaceWireless.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java b/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java index 8e44bf754..a8d69efca 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java @@ -302,8 +302,19 @@ protected void mouseClicked(final int xCoord, final int yCoord, final int btn) { return; } super.mouseClicked(xCoord, yCoord, btn); + if (doDelayedGuiInit) { + // the super.mouseClicked call just above ends up looping on the button list + // and execute the action for any button below the mouse. + // Therefore, if we initGui() the terminal in the actionPerformed method below + // it will run the actionPerformed a second time for the new button + // that will end up being below the mouse after the initGui() + initGui(); + doDelayedGuiInit = false; + } } + private boolean doDelayedGuiInit; + @Override protected void actionPerformed(final GuiButton btn) { if (btn == guiButtonAssemblersOnly) { @@ -323,7 +334,7 @@ protected void actionPerformed(final GuiButton btn) { if (btn == this.terminalStyleBox) { AEConfig.instance.settings.putSetting(iBtn.getSetting(), next); - initGui(); + doDelayedGuiInit = true; } else if (btn == searchStringSave) { AEConfig.instance.preserveSearchBar = next == YesNo.YES; }