fix(glfw): Add more missing methods and fields

This commit is contained in:
tomikun
2026-06-09 08:45:56 +08:00
parent 1f8bf59b0a
commit 8b95c43a85
6 changed files with 253 additions and 17 deletions

View File

@@ -1 +1 @@
7e958ece157c2208c2a8c715a4f92b684b112cfa
aff7797644cf0e93bb294391d8ecff7773ac1390

View File

@@ -1 +1 @@
80680c59be7562f6efefb301122e421068d6c652
f704d3ed9acf44729478f8b4498e5ce3f9aef314

View File

@@ -295,7 +295,8 @@ public class GLFW
GLFW_NO_WINDOW_CONTEXT = 0x1000A,
GLFW_CURSOR_UNAVAILABLE = 0x1000B,
GLFW_FEATURE_UNAVAILABLE = 0x1000C,
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D;
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D,
GLFW_PLATFORM_UNAVAILABLE = 0x1000E;
public static final int
GLFW_FOCUSED = 0x20001,
@@ -309,7 +310,10 @@ public class GLFW
GLFW_CENTER_CURSOR = 0x20009,
GLFW_TRANSPARENT_FRAMEBUFFER = 0x2000A,
GLFW_HOVERED = 0x2000B,
GLFW_FOCUS_ON_SHOW = 0x2000C;
GLFW_FOCUS_ON_SHOW = 0x2000C,
GLFW_MOUSE_PASSTHROUGH = 0x2000D,
GLFW_POSITION_X = 0x2000E,
GLFW_POSITION_Y = 0x2000F;
/** Input options. */
public static final int
@@ -371,8 +375,13 @@ public class GLFW
/** Init hints. */
public static final int
GLFW_JOYSTICK_HAT_BUTTONS = 0x50001,
GLFW_ANGLE_PLATFORM_TYPE = 0x50002,
GLFW_ANY_POSITION = 0x80000000,
GLFW_PLATFORM = 0x50003,
GLFW_COCOA_CHDIR_RESOURCES = 0x51001,
GLFW_COCOA_MENUBAR = 0x51002;
GLFW_COCOA_MENUBAR = 0x51002,
GLFW_X11_XCB_VULKAN_SURFACE = 0x52001,
GLFW_WAYLAND_LIBDECOR = 0x53001;
/** Hint value for {@link #GLFW_PLATFORM PLATFORM} that enables automatic platform selection. */
public static final int
@@ -413,6 +422,7 @@ public class GLFW
GLFW_CONTEXT_ROBUSTNESS = 0x22005,
GLFW_OPENGL_FORWARD_COMPAT = 0x22006,
GLFW_OPENGL_DEBUG_CONTEXT = 0x22007,
GLFW_CONTEXT_DEBUG = GLFW_OPENGL_DEBUG_CONTEXT,
GLFW_OPENGL_PROFILE = 0x22008,
GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x22009,
GLFW_CONTEXT_NO_ERROR = 0x2200A,
@@ -447,6 +457,13 @@ public class GLFW
*/
public static final int GLFW_WIN32_KEYBOARD_MENU = 0x25001;
/**
* Allows specification of the Wayland {@code app_id}.
*
* <p>This is ignored on other platforms.</p>
*/
public static final int GLFW_WAYLAND_APP_ID = 0x26001;
/** Values for the {@link #GLFW_CLIENT_API CLIENT_API} hint. */
public static final int
GLFW_NO_API = 0,
@@ -477,6 +494,19 @@ public class GLFW
GLFW_EGL_CONTEXT_API = 0x36002,
GLFW_OSMESA_CONTEXT_API = 0x36003;
public static final int
GLFW_ANGLE_PLATFORM_TYPE_NONE = 0x37001,
GLFW_ANGLE_PLATFORM_TYPE_OPENGL = 0x37002,
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES = 0x37003,
GLFW_ANGLE_PLATFORM_TYPE_D3D9 = 0x37004,
GLFW_ANGLE_PLATFORM_TYPE_D3D11 = 0x37005,
GLFW_ANGLE_PLATFORM_TYPE_VULKAN = 0x37007,
GLFW_ANGLE_PLATFORM_TYPE_METAL = 0x37008;
public static final int
GLFW_WAYLAND_PREFER_LIBDECOR = 0x38001,
GLFW_WAYLAND_DISABLE_LIBDECOR = 0x38002;
// GLFW Callbacks
/* volatile */ public static GLFWCharCallback mGLFWCharCallback;
/* volatile */ public static GLFWCharModsCallback mGLFWCharModsCallback;
@@ -835,10 +865,16 @@ public class GLFW
public static void glfwInitHint(int hint, int value) { }
public static void glfwInitAllocator(@Nullable @NativeType("GLFWallocator const *") GLFWAllocator allocator) { }
public static int glfwGetPlatform() {
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;
@@ -854,6 +890,20 @@ public class GLFW
height.put(internalGetWindow(window).height);
}
public static void glfwGetWindowFrameSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") IntBuffer left, @Nullable @NativeType("int *") IntBuffer top, @Nullable @NativeType("int *") IntBuffer right, @Nullable @NativeType("int *") IntBuffer bottom) {
if (CHECKS) {
checkSafe(left, 1);
checkSafe(top, 1);
checkSafe(right, 1);
checkSafe(bottom, 1);
}
}
public static void glfwGetWindowContentScale(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("float *") FloatBuffer xscale, @Nullable @NativeType("float *") FloatBuffer yscale) {
if (xscale != null) xscale.put(scale);
if (yscale != null) yscale.put(scale);
}
@Nullable
@NativeType("GLFWmonitor **")
public static PointerBuffer glfwGetMonitors() {
@@ -891,6 +941,26 @@ public class GLFW
height.put(mGLFWWindowHeight);
}
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer widthMM, @Nullable @NativeType("int *") IntBuffer heightMM) {
if (widthMM != null && heightMM != null) {
widthMM.put(mGLFWWindowWidth);
heightMM.put(mGLFWWindowHeight);
}
}
@Nullable // The normal implementation is nullable.
@NativeType("char const *")
public static String glfwGetMonitorName(@NativeType("GLFWmonitor *") long monitor) {
return String.format(Locale.US, "Android Display (%dx%d)", mGLFWWindowWidth, mGLFWWindowHeight);
}
public static void glfwSetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor, @NativeType("void *") long pointer) {
}
public static long glfwGetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor) {
return 0L;
}
@NativeType("GLFWmonitor *")
public static long glfwGetWindowMonitor(@NativeType("GLFWwindow *") long window) {
return mGLFWWindowMonitor;
@@ -909,6 +979,13 @@ public class GLFW
internalGetWindow(window).windowAttribs.put(attrib, value);
}
public static void glfwSetWindowUserPointer(@NativeType("GLFWwindow *") long window, @NativeType("void *") long pointer) {
}
public static long glfwGetWindowUserPointer(@NativeType("GLFWwindow *") long window) {
return 0L;
}
public static void glfwGetVersion(IntBuffer major, IntBuffer minor, IntBuffer rev) {
if (CHECKS) {
checkSafe(major, 1);
@@ -950,6 +1027,10 @@ public class GLFW
public static GLFWGammaRamp glfwGetGammaRamp(@NativeType("GLFWmonitor *") long monitor) {
return mGLFWGammaRamp;
}
public static void glfwSetGamma(@NativeType("GLFWmonitor *") long monitor, float gamma) {
}
public static void glfwSetGammaRamp(@NativeType("GLFWmonitor *") long monitor, @NativeType("const GLFWgammaramp *") GLFWGammaRamp ramp) {
mGLFWGammaRamp = ramp;
}
@@ -1116,6 +1197,9 @@ public class GLFW
public static void glfwSetWindowSizeLimits(@NativeType("GLFWwindow *") long window, int minwidth, int minheight, int maxwidth, int maxheight) {
}
public static void glfwSetWindowAspectRatio(@NativeType("GLFWwindow *") long window, int numer, int denom) {
}
public static void glfwSetWindowPos(long window, int x, int y) {
internalGetWindow(window).x = x;
internalGetWindow(window).y = y;
@@ -1128,6 +1212,22 @@ public class GLFW
System.out.println("GLFW: Set size for window " + window + ", width=" + width + ", height=" + height);
}
public static float glfwGetWindowOpacity(@NativeType("GLFWwindow *") long window) {
return 1.0f;
}
public static void glfwSetWindowOpacity(@NativeType("GLFWwindow *") long window, float opacity) {
}
public static void glfwIconifyWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwRestoreWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwMaximizeWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwShowWindow(long window) {
GLFWWindowProperties win = internalGetWindow(window);
win.windowAttribs.put(GLFW_HOVERED, 1);
@@ -1141,6 +1241,9 @@ public class GLFW
win.windowAttribs.put(GLFW_VISIBLE, 0);
}
public static void glfwFocusWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwWindowHint(int hint, int value) {
if (hint == GLFW_VISIBLE) {
mGLFWWindowVisibleOnCreation = value == GLFW_TRUE;
@@ -1398,17 +1501,12 @@ public class GLFW
}
/** Array version of: {@link #glfwGetMonitorPhysicalSize GetMonitorPhysicalSize} */
/*
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] widthMM, @Nullable @NativeType("int *") int[] heightMM) {
long __functionAddress = Functions.GetMonitorPhysicalSize;
if (CHECKS) {
// check(monitor);
checkSafe(widthMM, 1);
checkSafe(heightMM, 1);
if (widthMM != null && heightMM != null) {
widthMM[0] = mGLFWWindowWidth;
heightMM[0] = mGLFWWindowHeight;
}
invokePPPV(monitor, widthMM, heightMM, __functionAddress);
}
*/
/** Array version of: {@link #glfwGetMonitorContentScale GetMonitorContentScale} */
@@ -1513,4 +1611,12 @@ public class GLFW
// Fast path, but will return true if one has the same prefix
return glGetString(GL_EXTENSIONS).contains(ext);
}
public static long glfwGetProcAddress(@NativeType("char const *") ByteBuffer procname) {
throw new UnsupportedOperationException("Unimplemented!");
}
public static long glfwGetProcAddress(@NativeType("char const *") CharSequence procname) {
throw new UnsupportedOperationException("Unimplemented!");
}
}

View File

@@ -297,7 +297,8 @@ public class GLFW
GLFW_NO_WINDOW_CONTEXT = 0x1000A,
GLFW_CURSOR_UNAVAILABLE = 0x1000B,
GLFW_FEATURE_UNAVAILABLE = 0x1000C,
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D;
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D,
GLFW_PLATFORM_UNAVAILABLE = 0x1000E;
public static final int
GLFW_FOCUSED = 0x20001,
@@ -311,7 +312,11 @@ public class GLFW
GLFW_CENTER_CURSOR = 0x20009,
GLFW_TRANSPARENT_FRAMEBUFFER = 0x2000A,
GLFW_HOVERED = 0x2000B,
GLFW_FOCUS_ON_SHOW = 0x2000C;
GLFW_FOCUS_ON_SHOW = 0x2000C,
GLFW_MOUSE_PASSTHROUGH = 0x2000D,
GLFW_POSITION_X = 0x2000E,
GLFW_POSITION_Y = 0x2000F,
GLFW_SOFT_FULLSCREEN = 0x20010;
/** Input options. */
public static final int
@@ -373,8 +378,15 @@ public class GLFW
/** Init hints. */
public static final int
GLFW_JOYSTICK_HAT_BUTTONS = 0x50001,
GLFW_ANGLE_PLATFORM_TYPE = 0x50002,
GLFW_ANY_POSITION = 0x80000000,
GLFW_PLATFORM = 0x50003,
GLFW_MANAGE_PREEDIT_CANDIDATE = 0x50004,
GLFW_COCOA_CHDIR_RESOURCES = 0x51001,
GLFW_COCOA_MENUBAR = 0x51002;
GLFW_COCOA_MENUBAR = 0x51002,
GLFW_X11_XCB_VULKAN_SURFACE = 0x52001,
GLFW_X11_ONTHESPOT = 0x52002,
GLFW_WAYLAND_LIBDECOR = 0x53001;
/** Hint value for {@link #GLFW_PLATFORM PLATFORM} that enables automatic platform selection. */
public static final int
@@ -415,11 +427,13 @@ public class GLFW
GLFW_CONTEXT_ROBUSTNESS = 0x22005,
GLFW_OPENGL_FORWARD_COMPAT = 0x22006,
GLFW_OPENGL_DEBUG_CONTEXT = 0x22007,
GLFW_CONTEXT_DEBUG = GLFW_OPENGL_DEBUG_CONTEXT,
GLFW_OPENGL_PROFILE = 0x22008,
GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x22009,
GLFW_CONTEXT_NO_ERROR = 0x2200A,
GLFW_CONTEXT_CREATION_API = 0x2200B,
GLFW_SCALE_TO_MONITOR = 0x2200C;
GLFW_SCALE_TO_MONITOR = 0x2200C,
GLFW_SCALE_FRAMEBUFFER = 0x2200D;
/** Specifies whether to use full resolution framebuffers on Retina displays. This is ignored on other platforms. */
public static final int GLFW_COCOA_RETINA_FRAMEBUFFER = 0x23001;
@@ -449,6 +463,15 @@ public class GLFW
*/
public static final int GLFW_WIN32_KEYBOARD_MENU = 0x25001;
public static final int GLFW_WIN32_SHOWDEFAULT = 0x25002;
/**
* Allows specification of the Wayland {@code app_id}.
*
* <p>This is ignored on other platforms.</p>
*/
public static final int GLFW_WAYLAND_APP_ID = 0x26001;
/** Values for the {@link #GLFW_CLIENT_API CLIENT_API} hint. */
public static final int
GLFW_NO_API = 0,
@@ -479,6 +502,19 @@ public class GLFW
GLFW_EGL_CONTEXT_API = 0x36002,
GLFW_OSMESA_CONTEXT_API = 0x36003;
public static final int
GLFW_ANGLE_PLATFORM_TYPE_NONE = 0x37001,
GLFW_ANGLE_PLATFORM_TYPE_OPENGL = 0x37002,
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES = 0x37003,
GLFW_ANGLE_PLATFORM_TYPE_D3D9 = 0x37004,
GLFW_ANGLE_PLATFORM_TYPE_D3D11 = 0x37005,
GLFW_ANGLE_PLATFORM_TYPE_VULKAN = 0x37007,
GLFW_ANGLE_PLATFORM_TYPE_METAL = 0x37008;
public static final int
GLFW_WAYLAND_PREFER_LIBDECOR = 0x38001,
GLFW_WAYLAND_DISABLE_LIBDECOR = 0x38002;
// GLFW Callbacks
/* volatile */ public static GLFWCharCallback mGLFWCharCallback;
/* volatile */ public static GLFWCharModsCallback mGLFWCharModsCallback;
@@ -864,6 +900,8 @@ public class GLFW
public static void glfwInitHint(int hint, int value) { }
public static void glfwInitAllocator(@Nullable @NativeType("GLFWallocator const *") GLFWAllocator allocator) { }
public static int glfwGetPlatform() {
return GLFW_PLATFORM_X11;
}
@@ -887,6 +925,24 @@ public class GLFW
height.put(internalGetWindow(window).height);
}
public static void glfwGetWindowFrameSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") IntBuffer left, @Nullable @NativeType("int *") IntBuffer top, @Nullable @NativeType("int *") IntBuffer right, @Nullable @NativeType("int *") IntBuffer bottom) {
if (CHECKS) {
checkSafe(left, 1);
checkSafe(top, 1);
checkSafe(right, 1);
checkSafe(bottom, 1);
}
if (left != null) left.put(0);
if (top != null) top.put(0);
if (right != null) right.put(internalGetWindow(window).width);
if (bottom != null) bottom.put(internalGetWindow(window).height);
}
public static void glfwGetWindowContentScale(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("float *") FloatBuffer xscale, @Nullable @NativeType("float *") FloatBuffer yscale) {
if (xscale != null) xscale.put(scale);
if (yscale != null) yscale.put(scale);
}
@Nullable
@NativeType("GLFWmonitor **")
public static PointerBuffer glfwGetMonitors() {
@@ -924,6 +980,26 @@ public class GLFW
height.put(mGLFWWindowHeight);
}
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer widthMM, @Nullable @NativeType("int *") IntBuffer heightMM) {
if (widthMM != null && heightMM != null) {
widthMM.put(mGLFWWindowWidth);
heightMM.put(mGLFWWindowHeight);
}
}
@Nullable // The normal implementation is nullable.
@NativeType("char const *")
public static String glfwGetMonitorName(@NativeType("GLFWmonitor *") long monitor) {
return String.format(Locale.US, "Android Display (%dx%d)", mGLFWWindowWidth, mGLFWWindowHeight);
}
public static void glfwSetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor, @NativeType("void *") long pointer) {
}
public static long glfwGetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor) {
return 0L;
}
@NativeType("GLFWmonitor *")
public static long glfwGetWindowMonitor(@NativeType("GLFWwindow *") long window) {
return mGLFWWindowMonitor;
@@ -942,6 +1018,13 @@ public class GLFW
internalGetWindow(window).windowAttribs.put(attrib, value);
}
public static void glfwSetWindowUserPointer(@NativeType("GLFWwindow *") long window, @NativeType("void *") long pointer) {
}
public static long glfwGetWindowUserPointer(@NativeType("GLFWwindow *") long window) {
return NULL;
}
public static void glfwGetVersion(IntBuffer major, IntBuffer minor, IntBuffer rev) {
if (CHECKS) {
checkSafe(major, 1);
@@ -983,6 +1066,10 @@ public class GLFW
public static GLFWGammaRamp glfwGetGammaRamp(@NativeType("GLFWmonitor *") long monitor) {
return mGLFWGammaRamp;
}
public static void glfwSetGamma(@NativeType("GLFWmonitor *") long monitor, float gamma) {
}
public static void glfwSetGammaRamp(@NativeType("GLFWmonitor *") long monitor, @NativeType("const GLFWgammaramp *") GLFWGammaRamp ramp) {
mGLFWGammaRamp = ramp;
}
@@ -1149,6 +1236,9 @@ public class GLFW
public static void glfwSetWindowSizeLimits(@NativeType("GLFWwindow *") long window, int minwidth, int minheight, int maxwidth, int maxheight) {
}
public static void glfwSetWindowAspectRatio(@NativeType("GLFWwindow *") long window, int numer, int denom) {
}
public static void glfwSetWindowPos(long window, int x, int y) {
internalGetWindow(window).x = x;
internalGetWindow(window).y = y;
@@ -1161,6 +1251,22 @@ public class GLFW
System.out.println("GLFW: Set size for window " + window + ", width=" + width + ", height=" + height);
}
public static float glfwGetWindowOpacity(@NativeType("GLFWwindow *") long window) {
return 1.0f;
}
public static void glfwSetWindowOpacity(@NativeType("GLFWwindow *") long window, float opacity) {
}
public static void glfwIconifyWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwRestoreWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwMaximizeWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwShowWindow(long window) {
GLFWWindowProperties win = internalGetWindow(window);
win.windowAttribs.put(GLFW_HOVERED, 1);
@@ -1174,6 +1280,9 @@ public class GLFW
win.windowAttribs.put(GLFW_VISIBLE, 0);
}
public static void glfwFocusWindow(@NativeType("GLFWwindow *") long window) {
}
public static void glfwWindowHint(int hint, int value) {
if (hint == GLFW_VISIBLE) {
mGLFWWindowVisibleOnCreation = value == GLFW_TRUE;
@@ -1431,6 +1540,13 @@ public class GLFW
}
/** Array version of: {@link #glfwGetMonitorPhysicalSize GetMonitorPhysicalSize} */
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] widthMM, @Nullable @NativeType("int *") int[] heightMM) {
if (widthMM != null && heightMM != null) {
widthMM[0] = mGLFWWindowWidth;
heightMM[0] = mGLFWWindowHeight;
}
}
/*
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] widthMM, @Nullable @NativeType("int *") int[] heightMM) {
long __functionAddress = Functions.GetMonitorPhysicalSize;
@@ -1546,4 +1662,18 @@ public class GLFW
// Fast path, but will return true if one has the same prefix
return glGetString(GL_EXTENSIONS).contains(ext);
}
public static long glfwGetProcAddress(@NativeType("char const *") ByteBuffer procname) {
throw new UnsupportedOperationException("Unimplemented!");
}
public static long glfwGetProcAddress(@NativeType("char const *") CharSequence procname) {
throw new UnsupportedOperationException("Unimplemented!");
}
public static void glfwGetPreeditCursorRectangle(@NativeType("GLFWwindow *") long window, @NativeType("int *") @Nullable IntBuffer x, @NativeType("int *") @Nullable IntBuffer y, @NativeType("int *") @Nullable IntBuffer w, @NativeType("int *") @Nullable IntBuffer h) { }
public static void glfwGetPreeditCursorRectangle(@NativeType("GLFWwindow *") long window, @NativeType("int *") int @Nullable [] x, @NativeType("int *") int @Nullable [] y, @NativeType("int *") int @Nullable [] w, @NativeType("int *") int @Nullable [] h) { }
public static void glfwSetPreeditCursorRectangle(@NativeType("GLFWwindow *") long window, int x, int y, int w, int h) { }
public static void glfwResetPreeditText(@NativeType("GLFWwindow *") long window) { }
@Nullable public static IntBuffer glfwGetPreeditCandidate(@NativeType("GLFWwindow *") long window, int index) { return null; }
}