Fix a regression in 32d2d78

Cleanup in the said commit accidentally removed pause on idle
This commit is contained in:
khanhduytran0 committed 2023-10-01 21:13:19 +07:00
1 parent 54fb8a346d
commit f9ca95df8e
3 files changed
+4 -15

No files matched your search

+1
View File
@@ -48,6 +48,7 @@
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
CallbackBridge_pauseGameIfNeed();
}
@end
+2 -14
View File
@@ -592,21 +592,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwSetShowingWindow(JNIEnv* en
showingWindow = (long) window;
}
void CallbackBridge_setWindowAttrib(int attrib, int value) {
if (attrib == GLFW_VISIBLE && value == 0 && isGrabbing) {
void CallbackBridge_pauseGameIfNeed() {
if (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.
return;
}
(*runtimeJNIEnvPtr)->CallStaticVoidMethod(
runtimeJNIEnvPtr,
vmGlfwClass, method_glfwSetWindowAttrib,
(jlong) showingWindow, attrib, value
);
}
+1 -1
View File
@@ -105,4 +105,4 @@ void CallbackBridge_nativeSendMouseButton(int button, int action, int mods);
void CallbackBridge_nativeSendScreenSize(int width, int height);
void CallbackBridge_nativeSendScroll(CGFloat xoffset, CGFloat yoffset);
void CallbackBridge_sendKeycode(int keycode, jchar keychar, int scancode, int modifiers, BOOL isDown);
void CallbackBridge_setWindowAttrib(int attrib, int value);
void CallbackBridge_pauseGameIfNeed();