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