From 325db15a1d2eabdffbd60c6e581a96729387c1f6 Mon Sep 17 00:00:00 2001 From: Michael Pfaff Date: Wed, 10 Aug 2022 11:43:59 -0400 Subject: [PATCH] More progress, nearly fixed native header generation BufferUtils.c and CallbackUtil.c have been modified to not include the generated header file. This is because `javac` is choosing to ignore those files for generation of headers for unknown reasons. --- build.xml | 186 +++++++++--------- platform_build/bsd_ant/build.xml | 6 +- platform_build/build-definitions.xml | 2 +- platform_build/build-generator.xml | 25 ++- platform_build/linux_ant/build.xml | 2 + platform_build/linux_ant/build_es.xml | 13 +- platform_build/macosx_ant/build.xml | 1 + platform_build/mingw_ant/build.xml | 10 +- platform_build/windows_ant/build.xml | 12 +- platform_build/windows_ant/build_es.xml | 12 +- src/java/org/lwjgl/BufferUtils.java | 2 + src/java/org/lwjgl/LWJGLUtil.java | 113 ++++++----- .../org/lwjgl/LinuxSysImplementation.java | 4 +- .../org/lwjgl/MacOSXSysImplementation.java | 4 +- src/java/org/lwjgl/input/Cursor.java | 3 + src/java/org/lwjgl/input/Mouse.java | 12 +- src/java/org/lwjgl/opencl/CallbackUtil.java | 4 +- src/java/org/lwjgl/opengl/Display.java | 19 +- src/java/org/lwjgl/opengl/LinuxDisplay.java | 10 +- src/java/org/lwjgl/opengl/MacOSXDisplay.java | 6 +- src/java/org/lwjgl/opengl/Pbuffer.java | 17 ++ src/java/org/lwjgl/opengl/WindowsDisplay.java | 4 +- src/native/common/org_lwjgl_BufferUtils.c | 2 +- .../common/org_lwjgl_opencl_CallbackUtil.c | 2 +- src/native/linux/opengl/context.c | 9 +- .../linux/org_lwjgl_opengl_LinuxKeyboard.c | 1 + 26 files changed, 234 insertions(+), 247 deletions(-) diff --git a/build.xml b/build.xml index 5083b6b6..995daae7 100644 --- a/build.xml +++ b/build.xml @@ -74,7 +74,10 @@ - + + + + @@ -83,7 +86,7 @@ - + @@ -95,7 +98,7 @@ - + @@ -165,32 +168,32 @@ - + @@ -390,21 +393,21 @@ - + - + - + @@ -447,24 +450,17 @@ - + - - - - - - - - - + + - - + + - + @@ -532,7 +528,7 @@ - + diff --git a/platform_build/bsd_ant/build.xml b/platform_build/bsd_ant/build.xml index c49322ba..9295f61b 100644 --- a/platform_build/bsd_ant/build.xml +++ b/platform_build/bsd_ant/build.xml @@ -77,7 +77,7 @@ - + @@ -91,6 +91,7 @@ + @@ -112,7 +113,7 @@ - + @@ -126,6 +127,7 @@ + diff --git a/platform_build/build-definitions.xml b/platform_build/build-definitions.xml index 97829d93..691d1721 100644 --- a/platform_build/build-definitions.xml +++ b/platform_build/build-definitions.xml @@ -11,6 +11,7 @@ + @@ -25,7 +26,6 @@ - diff --git a/platform_build/build-generator.xml b/platform_build/build-generator.xml index 01441891..c3a0c2cf 100644 --- a/platform_build/build-generator.xml +++ b/platform_build/build-generator.xml @@ -11,14 +11,21 @@ - + - + + + + + + + + - + @@ -152,13 +159,13 @@ - + - + @@ -214,7 +221,7 @@ - + @@ -229,7 +236,7 @@ - + diff --git a/platform_build/linux_ant/build.xml b/platform_build/linux_ant/build.xml index 344d4e3d..6d010e5f 100644 --- a/platform_build/linux_ant/build.xml +++ b/platform_build/linux_ant/build.xml @@ -63,6 +63,7 @@ + @@ -95,6 +96,7 @@ + diff --git a/platform_build/linux_ant/build_es.xml b/platform_build/linux_ant/build_es.xml index 73dde1dc..ca16a3e1 100644 --- a/platform_build/linux_ant/build_es.xml +++ b/platform_build/linux_ant/build_es.xml @@ -9,15 +9,6 @@ - - - - - - - - - @@ -63,7 +54,7 @@ - + @@ -74,6 +65,7 @@ + @@ -106,6 +98,7 @@ + diff --git a/platform_build/macosx_ant/build.xml b/platform_build/macosx_ant/build.xml index 3f49d651..01238421 100644 --- a/platform_build/macosx_ant/build.xml +++ b/platform_build/macosx_ant/build.xml @@ -97,6 +97,7 @@ + diff --git a/platform_build/mingw_ant/build.xml b/platform_build/mingw_ant/build.xml index 7237c6c6..b5449bd8 100644 --- a/platform_build/mingw_ant/build.xml +++ b/platform_build/mingw_ant/build.xml @@ -11,7 +11,7 @@ - + @@ -19,6 +19,7 @@ + @@ -49,13 +50,6 @@ - - - - - - - diff --git a/platform_build/windows_ant/build.xml b/platform_build/windows_ant/build.xml index d0f47d69..d5cdc9cc 100644 --- a/platform_build/windows_ant/build.xml +++ b/platform_build/windows_ant/build.xml @@ -6,7 +6,7 @@ - + @@ -15,6 +15,7 @@ + @@ -41,15 +42,6 @@ - - - - - - - - - diff --git a/platform_build/windows_ant/build_es.xml b/platform_build/windows_ant/build_es.xml index 8c52e19f..0c5b0fc6 100644 --- a/platform_build/windows_ant/build_es.xml +++ b/platform_build/windows_ant/build_es.xml @@ -6,7 +6,7 @@ - + @@ -15,6 +15,7 @@ + @@ -42,15 +43,6 @@ - - - - - - - - - diff --git a/src/java/org/lwjgl/BufferUtils.java b/src/java/org/lwjgl/BufferUtils.java index ef34235f..54cf899c 100644 --- a/src/java/org/lwjgl/BufferUtils.java +++ b/src/java/org/lwjgl/BufferUtils.java @@ -50,6 +50,8 @@ import java.nio.ShortBuffer; */ public final class BufferUtils { + @java.lang.annotation.Native + private static final int __FORCE_NATIVE_HEADER = 0; /** * Construct a direct native-ordered bytebuffer with the specified size. diff --git a/src/java/org/lwjgl/LWJGLUtil.java b/src/java/org/lwjgl/LWJGLUtil.java index 697399f6..d8d942fb 100644 --- a/src/java/org/lwjgl/LWJGLUtil.java +++ b/src/java/org/lwjgl/LWJGLUtil.java @@ -425,13 +425,9 @@ public class LWJGLUtil { return possible_paths.toArray(new String[possible_paths.size()]); } - static void execPrivileged(final String[] cmd_array) throws Exception { + static void execPrivileged(String... cmd_array) throws Exception { try { - Process process = AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Process run() throws Exception { - return Runtime.getRuntime().exec(cmd_array); - } - }); + Process process = AccessController.doPrivileged((PrivilegedExceptionAction) () -> Runtime.getRuntime().exec(cmd_array)); // Close unused streams to make sure the child process won't hang process.getInputStream().close(); process.getOutputStream().close(); @@ -441,62 +437,25 @@ public class LWJGLUtil { } } - private static String getPrivilegedProperty(final String property_name) { - return AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty(property_name); - } - }); + private static String getPrivilegedProperty(String property_name) { + return AccessController.doPrivileged((PrivilegedAction) () -> System.getProperty(property_name)); } - /** - * Tries to locate named library from the current ClassLoader - * This method exists because native libraries are loaded from native code, and as such - * is exempt from ClassLoader library loading rutines. It therefore always fails. - * We therefore invoke the protected method of the ClassLoader to see if it can - * locate it. - * - * @param libname Name of library to search for - * @param classloader Classloader to use - * @return Absolute path to library if found, otherwise null - */ - private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) { - Class c = null; - - try { - log("getPathFromClassLoader: searching for: " + libname); - c = classloader.getClass(); - while (c != null) { - final Class clazz = c; - try { - return AccessController.doPrivileged(new PrivilegedExceptionAction() { - public String run() throws Exception { - Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class); - findLibrary.setAccessible(true); - String path = (String)findLibrary.invoke(classloader, libname); - return path; - } - }); - } catch (PrivilegedActionException e) { - log("Failed to locate findLibrary method: " + e.getCause()); - c = c.getSuperclass(); - } + /** Gets a boolean property as a privileged action. */ + public static boolean getPrivilegedBoolean(String property_name) { + String s = getPrivilegedProperty(property_name); + if (s == null || s.equals("false")) return false; + if (LWJGLUtil.DEBUG) { + if (!s.equals("true")) { + LWJGLUtil.logger().log(() -> "Value of boolean property " + property_name + " is not one of [true, false]: " + s); } - } catch (Exception e) { - log("Failure locating " + e + " using classloader:" + c); } - return null; + return true; } - - /** - * Gets a boolean property as a privileged action. - */ - public static boolean getPrivilegedBoolean(final String property_name) { - return AccessController.doPrivileged(new PrivilegedAction() { - public Boolean run() { - return Boolean.getBoolean(property_name); - } - }); + + /** Gets a string property as a privileged action. */ + public static String getPrivilegedString(String property_name) { + return getPrivilegedProperty(property_name); } /** @@ -530,6 +489,46 @@ public class LWJGLUtil { }); } + /** + * Tries to locate named library from the current ClassLoader + * This method exists because native libraries are loaded from native code, and as such + * is exempt from ClassLoader library loading rutines. It therefore always fails. + * We therefore invoke the protected method of the ClassLoader to see if it can + * locate it. + * + * @param libname Name of library to search for + * @param classloader Classloader to use + * @return Absolute path to library if found, otherwise null + */ + private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) { + Class c = null; + + try { + if (LWJGLUtil.DEBUG) { + logger().log(() -> "getPathFromClassLoader: searching for: " + libname); + } + c = classloader.getClass(); + while (c != null) { + final Class clazz = c; + try { + return AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class); + findLibrary.setAccessible(true); + String path = (String)findLibrary.invoke(classloader, libname); + return path; + }); + } catch (PrivilegedActionException e) { + logger().log("Failed to locate findLibrary method", e.getCause()); + c = c.getSuperclass(); + } + } + } catch (Exception e) { + Class c1 = c; + logger().log(() -> "Failure locating using classloader " + c1, e); + } + return null; + } + /** * Method to determine if the current system is running a version of * Mac OS X better than the given version. This is only useful for Mac OS X diff --git a/src/java/org/lwjgl/LinuxSysImplementation.java b/src/java/org/lwjgl/LinuxSysImplementation.java index c75f95ac..0e8cabcd 100644 --- a/src/java/org/lwjgl/LinuxSysImplementation.java +++ b/src/java/org/lwjgl/LinuxSysImplementation.java @@ -35,6 +35,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.lang.UnsatisfiedLinkError; +import java.lang.annotation.Native; /** * @@ -43,6 +44,7 @@ import java.lang.UnsatisfiedLinkError; * $Id$ */ final class LinuxSysImplementation extends J2SESysImplementation { + @Native private static final int JNI_VERSION = 19; static { @@ -71,7 +73,7 @@ final class LinuxSysImplementation extends J2SESysImplementation { // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // right anyway. - String[] browsers = {"sensible-browser", "xdg-open", "google-chrome", "chromium", "firefox", "iceweasel", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; + String[] browsers = {"xdg-open", "sensible-browser"}; for ( final String browser : browsers ) { try { diff --git a/src/java/org/lwjgl/MacOSXSysImplementation.java b/src/java/org/lwjgl/MacOSXSysImplementation.java index b92cdeeb..aed0d1ef 100644 --- a/src/java/org/lwjgl/MacOSXSysImplementation.java +++ b/src/java/org/lwjgl/MacOSXSysImplementation.java @@ -36,6 +36,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.lang.UnsatisfiedLinkError; +import java.lang.annotation.Native; /** * @@ -44,6 +45,7 @@ import java.lang.UnsatisfiedLinkError; * $Id$ */ final class MacOSXSysImplementation extends J2SESysImplementation { + @Native private static final int JNI_VERSION = 25; static { @@ -57,7 +59,7 @@ final class MacOSXSysImplementation extends J2SESysImplementation { public boolean openURL(String url) { try { - FileManager.openURL(url); + LWJGLUtil.execPrivileged("open", url); return true; } catch (Exception e) { LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); diff --git a/src/java/org/lwjgl/input/Cursor.java b/src/java/org/lwjgl/input/Cursor.java index bdb776d6..e352b572 100644 --- a/src/java/org/lwjgl/input/Cursor.java +++ b/src/java/org/lwjgl/input/Cursor.java @@ -51,12 +51,15 @@ import org.lwjgl.Sys; public class Cursor { /** 1 bit transparency for native cursor */ + @java.lang.annotation.Native public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1; /** 8 bit alhpa native cursor */ + @java.lang.annotation.Native public static final int CURSOR_8_BIT_ALPHA = 2; /** animation native cursor */ + @java.lang.annotation.Native public static final int CURSOR_ANIMATION = 4; /** First element to display */ diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 9c32bc6f..ee4e897c 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -45,6 +45,8 @@ import org.lwjgl.Sys; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.InputImplementation; +import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean; + /** *
@@ -690,16 +692,6 @@ public class Mouse { } } - /** Gets a boolean property as a privileged action. */ - static boolean getPrivilegedBoolean(final String property_name) { - Boolean value = AccessController.doPrivileged(new PrivilegedAction() { - public Boolean run() { - return Boolean.getBoolean(property_name); - } - }); - return value; - } - /** * Retrieves whether or not the mouse cursor is within the bounds of the window. * If the mouse cursor was moved outside the display during a drag, then the result of calling diff --git a/src/java/org/lwjgl/opencl/CallbackUtil.java b/src/java/org/lwjgl/opencl/CallbackUtil.java index d70164ac..a009ed82 100644 --- a/src/java/org/lwjgl/opencl/CallbackUtil.java +++ b/src/java/org/lwjgl/opencl/CallbackUtil.java @@ -40,6 +40,8 @@ import java.util.Map; * @author Spasi */ final class CallbackUtil { + @java.lang.annotation.Native + private static final int __NATIVE_HEADER = 0; private static final Map contextUserData = new HashMap(); @@ -169,4 +171,4 @@ final class CallbackUtil { */ static native long getLogMessageToStderrAPPLE(); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index b367cfca..ce63dac9 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -62,6 +62,8 @@ import java.security.PrivilegedAction; import java.util.Arrays; import java.util.HashSet; +import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean; + public final class Display { private static final Thread shutdown_hook = new Thread() { @@ -1034,23 +1036,6 @@ public final class Display { return display_impl; } - /** Gets a boolean property as a privileged action. */ - static boolean getPrivilegedBoolean(final String property_name) { - String s = getPrivilegedString(property_name); - if (s == null || s.equals("false")) return false; - if (LWJGLUtil.DEBUG) { - if (!s.equals("true")) { - LWJGLUtil.logger().log(() -> "Value of boolean property " + property_name + " is not one of [true, false]: " + s); - } - } - return true; - } - - /** Gets a string property as a privileged action. */ - static String getPrivilegedString(final String property_name) { - return AccessController.doPrivileged((PrivilegedAction) () -> System.getProperty(property_name)); - } - private static void initControls() { // Automatically create mouse, keyboard and controller if ( !getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput") ) { diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java index 71e08936..c5dc5300 100644 --- a/src/java/org/lwjgl/opengl/LinuxDisplay.java +++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java @@ -208,7 +208,7 @@ final class LinuxDisplay implements DisplayImplementation { } private static boolean isXrandrSupported() { - if (Display.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR")) + if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR")) return false; try (LinuxDisplay.AWTLock _lock = awtLock()) { incDisplay(); @@ -240,7 +240,7 @@ final class LinuxDisplay implements DisplayImplementation { private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException; private static boolean isNetWMFullscreenSupported() throws LWJGLException { - if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM")) + if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_NETWM")) return false; try (LinuxDisplay.AWTLock _lock = awtLock()) { incDisplay(); @@ -467,7 +467,7 @@ final class LinuxDisplay implements DisplayImplementation { // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore, // unless org.lwjgl.opengl.Window.undecorated_fs has been specified. // See native/linux/org_lwjgl_opengl_Display.c, createWindow function. - boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs")); + boolean undecorated = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs")); this.parent = parent; parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen()); @@ -490,7 +490,7 @@ final class LinuxDisplay implements DisplayImplementation { current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable); // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell - wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS"); + wm_class = LWJGLUtil.getPrivilegedString("LWJGL_WM_CLASS"); if (wm_class == null) wm_class = Display.getTitle(); setClassHint(Display.getTitle(), wm_class); @@ -1414,7 +1414,7 @@ final class LinuxDisplay implements DisplayImplementation { } static void init() { - if ( Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") ) + if ( LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") ) return; AccessController.doPrivileged(new PrivilegedAction() { diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java index b46ce813..243f1844 100644 --- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java +++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java @@ -127,7 +127,7 @@ final class MacOSXDisplay implements DisplayImplementation { private native boolean nIsNativeMode(ByteBuffer peer_info_handle); private static boolean isUndecorated() { - return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); + return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); } public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { @@ -137,11 +137,11 @@ final class MacOSXDisplay implements DisplayImplementation { // OS X fullscreen mode API is only available on OS X 10.7+ boolean enableFullscreenModeAPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && - !Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI"); + !LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI"); // OS X high DPI mode is only available on OS X 10.7+ enableHighDPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && - (Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen); + (LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen); if (parented) this.canvas = parent; else this.canvas = null; diff --git a/src/java/org/lwjgl/opengl/Pbuffer.java b/src/java/org/lwjgl/opengl/Pbuffer.java index 2e88017c..241f7a2e 100644 --- a/src/java/org/lwjgl/opengl/Pbuffer.java +++ b/src/java/org/lwjgl/opengl/Pbuffer.java @@ -52,86 +52,103 @@ public final class Pbuffer extends DrawableGL { /** * Indicates that Pbuffers can be created. */ + @java.lang.annotation.Native public static final int PBUFFER_SUPPORTED = 1 << 0; /** * Indicates that Pbuffers can be used as render-textures. */ + @java.lang.annotation.Native public static final int RENDER_TEXTURE_SUPPORTED = 1 << 1; /** * Indicates that Pbuffers can be used as non-power-of-two render-textures. */ + @java.lang.annotation.Native public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED = 1 << 2; /** * Indicates that Pbuffers can be used as depth render-textures. */ + @java.lang.annotation.Native public static final int RENDER_DEPTH_TEXTURE_SUPPORTED = 1 << 3; /** * The render-to-texture mipmap level attribute. */ + @java.lang.annotation.Native public static final int MIPMAP_LEVEL = RenderTexture.WGL_MIPMAP_LEVEL_ARB; /** * The render-to-texture cube map face attribute. */ + @java.lang.annotation.Native public static final int CUBE_MAP_FACE = RenderTexture.WGL_CUBE_MAP_FACE_ARB; /** * The render-to-texture cube map positive X face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_POSITIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; /** * The render-to-texture cube map negative X face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; /** * The render-to-texture cube map positive Y face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; /** * The render-to-texture cube map negative Y face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; /** * The render-to-texture cube map positive Z face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; /** * The render-to-texture cube map negative Z face value. */ + @java.lang.annotation.Native public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; /** * The Pbuffer front left buffer. */ + @java.lang.annotation.Native public static final int FRONT_LEFT_BUFFER = RenderTexture.WGL_FRONT_LEFT_ARB; /** * The Pbuffer front right buffer. */ + @java.lang.annotation.Native public static final int FRONT_RIGHT_BUFFER = RenderTexture.WGL_FRONT_RIGHT_ARB; /** * The Pbuffer back left buffer. */ + @java.lang.annotation.Native public static final int BACK_LEFT_BUFFER = RenderTexture.WGL_BACK_LEFT_ARB; /** * The Pbuffer back right buffer. */ + @java.lang.annotation.Native public static final int BACK_RIGHT_BUFFER = RenderTexture.WGL_BACK_RIGHT_ARB; /** * The Pbuffer depth buffer. */ + @java.lang.annotation.Native public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV; /** diff --git a/src/java/org/lwjgl/opengl/WindowsDisplay.java b/src/java/org/lwjgl/opengl/WindowsDisplay.java index 2549673b..5c3e7f44 100644 --- a/src/java/org/lwjgl/opengl/WindowsDisplay.java +++ b/src/java/org/lwjgl/opengl/WindowsDisplay.java @@ -289,7 +289,7 @@ final class WindowsDisplay implements DisplayImplementation { private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private static boolean isUndecorated() { - return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); + return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); } private static long getHwnd(Canvas parent) throws LWJGLException { @@ -1232,4 +1232,4 @@ final class WindowsDisplay implements DisplayImplementation { return "Rect: left = " + left + " top = " + top + " right = " + right + " bottom = " + bottom + ", width: " + (right - left) + ", height: " + (bottom - top); } } -} \ No newline at end of file +} diff --git a/src/native/common/org_lwjgl_BufferUtils.c b/src/native/common/org_lwjgl_BufferUtils.c index be80123c..ba5b061e 100644 --- a/src/native/common/org_lwjgl_BufferUtils.c +++ b/src/native/common/org_lwjgl_BufferUtils.c @@ -1,4 +1,4 @@ -#include "org_lwjgl_BufferUtils.h" +//#include "org_lwjgl_BufferUtils.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) { diff --git a/src/native/common/org_lwjgl_opencl_CallbackUtil.c b/src/native/common/org_lwjgl_opencl_CallbackUtil.c index 17d937db..a73899ea 100644 --- a/src/native/common/org_lwjgl_opencl_CallbackUtil.c +++ b/src/native/common/org_lwjgl_opencl_CallbackUtil.c @@ -39,7 +39,7 @@ #include #include "common_tools.h" #include "extcl.h" -#include "org_lwjgl_opencl_CallbackUtil.h" +//#include "org_lwjgl_opencl_CallbackUtil.h" static jmethodID contextCallbackJ; static jmethodID memObjectDestructorCallbackJ; diff --git a/src/native/linux/opengl/context.c b/src/native/linux/opengl/context.c index 123ccf0a..12e50ebc 100644 --- a/src/native/linux/opengl/context.c +++ b/src/native/linux/opengl/context.c @@ -228,17 +228,20 @@ static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int scree putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); - if (stereo) + if (stereo) { putAttrib(&attrib_list, GLX_STEREO); + } // Assume the caller has checked support for multisample if (samples > 0) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 - if ( colorSamples > 0 ) + if ( colorSamples > 0 ) { putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); + } } - if (sRGB) + if (sRGB) { putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); + } putAttrib(&attrib_list, None); return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs); } diff --git a/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c b/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c index ac8bceda..62bc6985 100644 --- a/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c +++ b/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c @@ -78,6 +78,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap(JNI JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym(JNIEnv *env, jclass unused, jlong display_ptr, jint key_code) { Display *disp = (Display *)(intptr_t)display_ptr; + // TODO: verify that XkbKeycodeToKeysym does not introduce any unwanted behaviour, then switch to it. KeySym key_sym = XKeycodeToKeysym(disp, key_code, 0); return key_sym; }