From 6ca2bb12f7bf0728bd91f790d020e65d09f53a9e Mon Sep 17 00:00:00 2001 From: alexytomi <60690056+alexytomi@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:53:41 +0800 Subject: [PATCH] fix(glfw): implement missing methods Added `glfwGetWindowTitle` (which doesn't seem to be used by Minecraft) Added `glfwPlatformSupported` Added `glfwSetPreeditCallback`, `glfwSetPreeditCandidateCallback`, `glfwSetIMEStatusCallback` --- .../src/main/java/org/lwjgl/glfw/GLFW.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java index 31285affb..7af387239 100644 --- a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java @@ -493,6 +493,10 @@ public class GLFW /* volatile */ public static GLFWWindowPosCallback mGLFWWindowPosCallback; /* volatile */ public static GLFWWindowRefreshCallback mGLFWWindowRefreshCallback; + public static GLFWPreeditCallback mGLFWPreeditCallback; + public static GLFWIMEStatusCallback mGLFWIMEStatusCallback; + public static GLFWPreeditCandidateCallback mGLFWPreeditCandidateCallback; + // Store callback method references directly to avoid a roundtrip through // JNI when calling the default LWJGL callbacks. @Nullable public static GLFWFramebufferSizeCallbackI mGLFWFramebufferSizeCallbackI; @@ -794,6 +798,28 @@ public class GLFW return lastCallback; } + public static GLFWPreeditCallback glfwSetPreeditCallback(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("GLFWpreeditfun") GLFWPreeditCallbackI cbfun) { + GLFWPreeditCallback lastCallback = mGLFWPreeditCallback; + if (cbfun == null) mGLFWPreeditCallback = null; + else mGLFWPreeditCallback = GLFWPreeditCallback.create(cbfun); + + return lastCallback; + } + public static GLFWIMEStatusCallback glfwSetIMEStatusCallback(@NativeType("GLFWwindow *") long window, @NativeType("GLFWimestatusfun") @Nullable GLFWIMEStatusCallbackI cbfun) { + GLFWIMEStatusCallback lastCallback = mGLFWIMEStatusCallback; + if (cbfun == null) mGLFWIMEStatusCallback = null; + else mGLFWIMEStatusCallback = GLFWIMEStatusCallback.create(cbfun); + + return lastCallback; + } + public static GLFWPreeditCandidateCallback glfwSetPreeditCandidateCallback(@NativeType("GLFWwindow *") long window, @NativeType("GLFWpreeditcandidatefun") @Nullable GLFWPreeditCandidateCallbackI cbfun) { + GLFWPreeditCandidateCallback lastCallback = mGLFWPreeditCandidateCallback; + if (cbfun == null) mGLFWPreeditCandidateCallback = null; + else mGLFWPreeditCandidateCallback = GLFWPreeditCandidateCallback.create(cbfun); + + return lastCallback; + } + public static GLFWWindowSizeCallback glfwSetWindowSizeCallback(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("GLFWwindowsizefun") GLFWWindowSizeCallbackI cbfun) { GLFWWindowSizeCallback previousCallback = null; if(mGLFWWindowSizeCallbackI != null) { @@ -832,6 +858,10 @@ public class GLFW return GLFW_PLATFORM_X11; } + public static boolean glfwPlatformSupported(int platform) { + return platform == GLFW_PLATFORM_X11; + } + @NativeType("GLFWwindow *") public static long glfwGetCurrentContext() { long __functionAddress = Functions.GetCurrentContext; @@ -1047,6 +1077,10 @@ public class GLFW nglfwSetShowingWindow(mGLFWWindowMap.size() == 0 ? 0 : mGLFWWindowMap.keyAt(mGLFWWindowMap.size() - 1)); } + public static String glfwGetWindowTitle(long window) { + return internalGetWindow(window).title.toString(); + } + public static void glfwDefaultWindowHints() { mGLFWWindowVisibleOnCreation = true; }