diff --git a/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index adecfba..5f7d9d7 100644 --- a/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -12,6 +12,7 @@ import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; import org.saturnclient.client.ServiceClient; import org.saturnclient.emotes.fabric.Emotes; +import org.saturnclient.impl.ui.SaturnScreenFabric; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; @@ -51,12 +52,20 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new ShiftMenu()); } - if (Config.openEmoteWheel.wasKeyPressed() && client.currentScreen == null + // The emote wheel key opens the wheel, and closes it again while it's open. Closing it + // from the screen's own key handling would reopen it on the next tick, since the key is + // still down and no screen is open by then. + if (Config.openEmoteWheel.wasKeyPressed() //? if >=1.21.9 { && !InputUtil.isKeyPressed(client.getWindow(), GLFW.GLFW_KEY_F3)) { //?} else //&& !InputUtil.isKeyPressed(client.getWindow().getHandle(), GLFW.GLFW_KEY_F3)) { - Providers.saturn.getClient().setScreen(new EmoteWheel()); + if (client.currentScreen == null) { + Providers.saturn.getClient().setScreen(new EmoteWheel()); + } else if (client.currentScreen instanceof SaturnScreenFabric saturnScreen + && saturnScreen.screen instanceof EmoteWheel) { + saturnScreen.close(); + } } // Sneaking cancels your own emote, for everyone.