From 716fa4fc21c6b45f3c28a89f956377610a9d3444 Mon Sep 17 00:00:00 2001 From: Sally Knight Date: Tue, 10 Mar 2026 16:49:50 +0300 Subject: [PATCH] fix: pass ESC keypress to screen (#161) --- Minecraft.Client/Minecraft.cpp | 4 +++- Minecraft.Client/UI/Screen.h | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 4e5e6f7ac..0f74ad0db 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -2106,7 +2106,9 @@ void Minecraft::pauseGame() { if (screen != NULL) { - setScreen(NULL); + // 4jcraft: Pass the keypress to the screen + // normally this would've been done in updateEvents(), but it works better here (for now atleast) + screen->keyPressed(0, Keyboard::KEY_ESCAPE); return; } #ifdef ENABLE_JAVA_GUIS diff --git a/Minecraft.Client/UI/Screen.h b/Minecraft.Client/UI/Screen.h index 169b49f33..c4a70736b 100644 --- a/Minecraft.Client/UI/Screen.h +++ b/Minecraft.Client/UI/Screen.h @@ -23,10 +23,9 @@ public: Screen(); // 4J added virtual void render(int xm, int ym, float a); -protected: - virtual void keyPressed(wchar_t eventCharacter, int eventKey); public: - static std::wstring getClipboard(); + virtual void keyPressed(wchar_t eventCharacter, int eventKey); + static std::wstring getClipboard(); static void setClipboard(const std::wstring& str); private: Button *clickedButton;