Skip to content

Commit 47789da

Browse files
committed
fix(glfw): Add more missing methods and fields
1 parent 1f8bf59 commit 47789da

6 files changed

Lines changed: 253 additions & 17 deletions

File tree

Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7e958ece157c2208c2a8c715a4f92b684b112cfa
1+
aff7797644cf0e93bb294391d8ecff7773ac1390
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
80680c59be7562f6efefb301122e421068d6c652
1+
f704d3ed9acf44729478f8b4498e5ce3f9aef314

jre_lwjgl3glfw/lwjgl-3.3.3/src/main/java/org/lwjgl/glfw/GLFW.java

Lines changed: 117 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ public class GLFW
295295
GLFW_NO_WINDOW_CONTEXT = 0x1000A,
296296
GLFW_CURSOR_UNAVAILABLE = 0x1000B,
297297
GLFW_FEATURE_UNAVAILABLE = 0x1000C,
298-
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D;
298+
GLFW_FEATURE_UNIMPLEMENTED = 0x1000D,
299+
GLFW_PLATFORM_UNAVAILABLE = 0x1000E;
299300

300301
public static final int
301302
GLFW_FOCUSED = 0x20001,
@@ -309,7 +310,10 @@ public class GLFW
309310
GLFW_CENTER_CURSOR = 0x20009,
310311
GLFW_TRANSPARENT_FRAMEBUFFER = 0x2000A,
311312
GLFW_HOVERED = 0x2000B,
312-
GLFW_FOCUS_ON_SHOW = 0x2000C;
313+
GLFW_FOCUS_ON_SHOW = 0x2000C,
314+
GLFW_MOUSE_PASSTHROUGH = 0x2000D,
315+
GLFW_POSITION_X = 0x2000E,
316+
GLFW_POSITION_Y = 0x2000F;
313317

314318
/** Input options. */
315319
public static final int
@@ -371,8 +375,13 @@ public class GLFW
371375
/** Init hints. */
372376
public static final int
373377
GLFW_JOYSTICK_HAT_BUTTONS = 0x50001,
378+
GLFW_ANGLE_PLATFORM_TYPE = 0x50002,
379+
GLFW_ANY_POSITION = 0x80000000,
380+
GLFW_PLATFORM = 0x50003,
374381
GLFW_COCOA_CHDIR_RESOURCES = 0x51001,
375-
GLFW_COCOA_MENUBAR = 0x51002;
382+
GLFW_COCOA_MENUBAR = 0x51002,
383+
GLFW_X11_XCB_VULKAN_SURFACE = 0x52001,
384+
GLFW_WAYLAND_LIBDECOR = 0x53001;
376385

377386
/** Hint value for {@link #GLFW_PLATFORM PLATFORM} that enables automatic platform selection. */
378387
public static final int
@@ -413,6 +422,7 @@ public class GLFW
413422
GLFW_CONTEXT_ROBUSTNESS = 0x22005,
414423
GLFW_OPENGL_FORWARD_COMPAT = 0x22006,
415424
GLFW_OPENGL_DEBUG_CONTEXT = 0x22007,
425+
GLFW_CONTEXT_DEBUG = GLFW_OPENGL_DEBUG_CONTEXT,
416426
GLFW_OPENGL_PROFILE = 0x22008,
417427
GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x22009,
418428
GLFW_CONTEXT_NO_ERROR = 0x2200A,
@@ -447,6 +457,13 @@ public class GLFW
447457
*/
448458
public static final int GLFW_WIN32_KEYBOARD_MENU = 0x25001;
449459

460+
/**
461+
* Allows specification of the Wayland {@code app_id}.
462+
*
463+
* <p>This is ignored on other platforms.</p>
464+
*/
465+
public static final int GLFW_WAYLAND_APP_ID = 0x26001;
466+
450467
/** Values for the {@link #GLFW_CLIENT_API CLIENT_API} hint. */
451468
public static final int
452469
GLFW_NO_API = 0,
@@ -477,6 +494,19 @@ public class GLFW
477494
GLFW_EGL_CONTEXT_API = 0x36002,
478495
GLFW_OSMESA_CONTEXT_API = 0x36003;
479496

497+
public static final int
498+
GLFW_ANGLE_PLATFORM_TYPE_NONE = 0x37001,
499+
GLFW_ANGLE_PLATFORM_TYPE_OPENGL = 0x37002,
500+
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES = 0x37003,
501+
GLFW_ANGLE_PLATFORM_TYPE_D3D9 = 0x37004,
502+
GLFW_ANGLE_PLATFORM_TYPE_D3D11 = 0x37005,
503+
GLFW_ANGLE_PLATFORM_TYPE_VULKAN = 0x37007,
504+
GLFW_ANGLE_PLATFORM_TYPE_METAL = 0x37008;
505+
506+
public static final int
507+
GLFW_WAYLAND_PREFER_LIBDECOR = 0x38001,
508+
GLFW_WAYLAND_DISABLE_LIBDECOR = 0x38002;
509+
480510
// GLFW Callbacks
481511
/* volatile */ public static GLFWCharCallback mGLFWCharCallback;
482512
/* volatile */ public static GLFWCharModsCallback mGLFWCharModsCallback;
@@ -835,10 +865,16 @@ public static void glfwTerminate() {
835865

836866
public static void glfwInitHint(int hint, int value) { }
837867

868+
public static void glfwInitAllocator(@Nullable @NativeType("GLFWallocator const *") GLFWAllocator allocator) { }
869+
838870
public static int glfwGetPlatform() {
839871
return GLFW_PLATFORM_X11;
840872
}
841873

874+
public static boolean glfwPlatformSupported(int platform) {
875+
return platform == GLFW_PLATFORM_X11;
876+
}
877+
842878
@NativeType("GLFWwindow *")
843879
public static long glfwGetCurrentContext() {
844880
long __functionAddress = Functions.GetCurrentContext;
@@ -854,6 +890,20 @@ public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long windo
854890
height.put(internalGetWindow(window).height);
855891
}
856892

893+
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) {
894+
if (CHECKS) {
895+
checkSafe(left, 1);
896+
checkSafe(top, 1);
897+
checkSafe(right, 1);
898+
checkSafe(bottom, 1);
899+
}
900+
}
901+
902+
public static void glfwGetWindowContentScale(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("float *") FloatBuffer xscale, @Nullable @NativeType("float *") FloatBuffer yscale) {
903+
if (xscale != null) xscale.put(scale);
904+
if (yscale != null) yscale.put(scale);
905+
}
906+
857907
@Nullable
858908
@NativeType("GLFWmonitor **")
859909
public static PointerBuffer glfwGetMonitors() {
@@ -891,6 +941,26 @@ public static void glfwGetMonitorWorkarea(@NativeType("GLFWmonitor *") long moni
891941
height.put(mGLFWWindowHeight);
892942
}
893943

944+
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer widthMM, @Nullable @NativeType("int *") IntBuffer heightMM) {
945+
if (widthMM != null && heightMM != null) {
946+
widthMM.put(mGLFWWindowWidth);
947+
heightMM.put(mGLFWWindowHeight);
948+
}
949+
}
950+
951+
@Nullable // The normal implementation is nullable.
952+
@NativeType("char const *")
953+
public static String glfwGetMonitorName(@NativeType("GLFWmonitor *") long monitor) {
954+
return String.format(Locale.US, "Android Display (%dx%d)", mGLFWWindowWidth, mGLFWWindowHeight);
955+
}
956+
957+
public static void glfwSetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor, @NativeType("void *") long pointer) {
958+
}
959+
960+
public static long glfwGetMonitorUserPointer(@NativeType("GLFWmonitor *") long monitor) {
961+
return 0L;
962+
}
963+
894964
@NativeType("GLFWmonitor *")
895965
public static long glfwGetWindowMonitor(@NativeType("GLFWwindow *") long window) {
896966
return mGLFWWindowMonitor;
@@ -909,6 +979,13 @@ public static void glfwSetWindowAttrib(@NativeType("GLFWwindow *") long window,
909979
internalGetWindow(window).windowAttribs.put(attrib, value);
910980
}
911981

982+
public static void glfwSetWindowUserPointer(@NativeType("GLFWwindow *") long window, @NativeType("void *") long pointer) {
983+
}
984+
985+
public static long glfwGetWindowUserPointer(@NativeType("GLFWwindow *") long window) {
986+
return 0L;
987+
}
988+
912989
public static void glfwGetVersion(IntBuffer major, IntBuffer minor, IntBuffer rev) {
913990
if (CHECKS) {
914991
checkSafe(major, 1);
@@ -950,6 +1027,10 @@ public static GLFWVidMode glfwGetVideoMode(long monitor) {
9501027
public static GLFWGammaRamp glfwGetGammaRamp(@NativeType("GLFWmonitor *") long monitor) {
9511028
return mGLFWGammaRamp;
9521029
}
1030+
1031+
public static void glfwSetGamma(@NativeType("GLFWmonitor *") long monitor, float gamma) {
1032+
}
1033+
9531034
public static void glfwSetGammaRamp(@NativeType("GLFWmonitor *") long monitor, @NativeType("const GLFWgammaramp *") GLFWGammaRamp ramp) {
9541035
mGLFWGammaRamp = ramp;
9551036
}
@@ -1116,6 +1197,9 @@ public static void glfwGetWindowSize(long window, IntBuffer width, IntBuffer hei
11161197
public static void glfwSetWindowSizeLimits(@NativeType("GLFWwindow *") long window, int minwidth, int minheight, int maxwidth, int maxheight) {
11171198
}
11181199

1200+
public static void glfwSetWindowAspectRatio(@NativeType("GLFWwindow *") long window, int numer, int denom) {
1201+
}
1202+
11191203
public static void glfwSetWindowPos(long window, int x, int y) {
11201204
internalGetWindow(window).x = x;
11211205
internalGetWindow(window).y = y;
@@ -1128,6 +1212,22 @@ public static void glfwSetWindowSize(long window, int width, int height) {
11281212
System.out.println("GLFW: Set size for window " + window + ", width=" + width + ", height=" + height);
11291213
}
11301214

1215+
public static float glfwGetWindowOpacity(@NativeType("GLFWwindow *") long window) {
1216+
return 1.0f;
1217+
}
1218+
1219+
public static void glfwSetWindowOpacity(@NativeType("GLFWwindow *") long window, float opacity) {
1220+
}
1221+
1222+
public static void glfwIconifyWindow(@NativeType("GLFWwindow *") long window) {
1223+
}
1224+
1225+
public static void glfwRestoreWindow(@NativeType("GLFWwindow *") long window) {
1226+
}
1227+
1228+
public static void glfwMaximizeWindow(@NativeType("GLFWwindow *") long window) {
1229+
}
1230+
11311231
public static void glfwShowWindow(long window) {
11321232
GLFWWindowProperties win = internalGetWindow(window);
11331233
win.windowAttribs.put(GLFW_HOVERED, 1);
@@ -1141,6 +1241,9 @@ public static void glfwHideWindow(long window) {
11411241
win.windowAttribs.put(GLFW_VISIBLE, 0);
11421242
}
11431243

1244+
public static void glfwFocusWindow(@NativeType("GLFWwindow *") long window) {
1245+
}
1246+
11441247
public static void glfwWindowHint(int hint, int value) {
11451248
if (hint == GLFW_VISIBLE) {
11461249
mGLFWWindowVisibleOnCreation = value == GLFW_TRUE;
@@ -1398,17 +1501,12 @@ public static void glfwGetMonitorWorkarea(@NativeType("GLFWmonitor *") long moni
13981501
}
13991502

14001503
/** Array version of: {@link #glfwGetMonitorPhysicalSize GetMonitorPhysicalSize} */
1401-
/*
14021504
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] widthMM, @Nullable @NativeType("int *") int[] heightMM) {
1403-
long __functionAddress = Functions.GetMonitorPhysicalSize;
1404-
if (CHECKS) {
1405-
// check(monitor);
1406-
checkSafe(widthMM, 1);
1407-
checkSafe(heightMM, 1);
1505+
if (widthMM != null && heightMM != null) {
1506+
widthMM[0] = mGLFWWindowWidth;
1507+
heightMM[0] = mGLFWWindowHeight;
14081508
}
1409-
invokePPPV(monitor, widthMM, heightMM, __functionAddress);
14101509
}
1411-
*/
14121510

14131511
/** Array version of: {@link #glfwGetMonitorContentScale GetMonitorContentScale} */
14141512

@@ -1513,4 +1611,12 @@ public static boolean glfwExtensionSupported(@NativeType("char const *") CharSeq
15131611
// Fast path, but will return true if one has the same prefix
15141612
return glGetString(GL_EXTENSIONS).contains(ext);
15151613
}
1614+
1615+
public static long glfwGetProcAddress(@NativeType("char const *") ByteBuffer procname) {
1616+
throw new UnsupportedOperationException("Unimplemented!");
1617+
}
1618+
1619+
public static long glfwGetProcAddress(@NativeType("char const *") CharSequence procname) {
1620+
throw new UnsupportedOperationException("Unimplemented!");
1621+
}
15161622
}

0 commit comments

Comments
 (0)