From feff1bdeff4425ff8132975a4f9dfcb27b1d43ee Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Sun, 21 May 2023 18:59:25 +0700 Subject: [PATCH] Reland: send esc on background enter This used to be there before, but was accidentally removed. --- Natives/input_bridge_v3.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Natives/input_bridge_v3.m b/Natives/input_bridge_v3.m index 8c5cdc45..db051407 100644 --- a/Natives/input_bridge_v3.m +++ b/Natives/input_bridge_v3.m @@ -504,6 +504,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwSetShowingWindow(JNIEnv* en } void CallbackBridge_setWindowAttrib(int attrib, int value) { + if (attrib == GLFW_VISIBLE && value == 0 && isGrabbing) { + CallbackBridge_nativeSendKey(GLFW_KEY_ESCAPE, 0, 1, 0); + CallbackBridge_nativeSendKey(GLFW_KEY_ESCAPE, 0, 0, 0); + } + if (!showingWindow || !isUseStackQueueCall) { // If the window is not shown, there is nothing to do yet. // For Minecraft < 1.13, calling to JNI functions here crashes the JVM for some reason, therefore it is skipped for now.