mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-06 23:14:19 +00:00
Moved Sys.JNI_VERSION to SysImplementation.getRequiredJNIVersion() to enable platform specific native library versions.
This commit is contained in:
parent
e584a5e0a0
commit
100dfa86a6
5 changed files with 25 additions and 10 deletions
|
|
@ -38,11 +38,15 @@ package org.lwjgl;
|
|||
* @version $Revision$
|
||||
* $Id$
|
||||
*/
|
||||
class LinuxSysImplementation extends J2SESysImplementation {
|
||||
final class LinuxSysImplementation extends J2SESysImplementation {
|
||||
static {
|
||||
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public boolean openURL(final String url) {
|
||||
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
|
||||
// right anyway.
|
||||
|
|
|
|||
|
|
@ -44,12 +44,16 @@ import com.apple.eio.FileManager;
|
|||
* @version $Revision$
|
||||
* $Id$
|
||||
*/
|
||||
class MacOSXSysImplementation extends J2SESysImplementation {
|
||||
final class MacOSXSysImplementation extends J2SESysImplementation {
|
||||
static {
|
||||
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
|
||||
Toolkit.getDefaultToolkit();
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public boolean openURL(String url) {
|
||||
try {
|
||||
FileManager.openURL(url);
|
||||
|
|
|
|||
|
|
@ -56,9 +56,6 @@ public final class Sys {
|
|||
/** Current version of library */
|
||||
private static final String VERSION = "2.0b1";
|
||||
|
||||
/** Current version of the JNI library */
|
||||
static final int JNI_VERSION = 16;
|
||||
|
||||
/** The implementation instance to delegate platform specific behavior to */
|
||||
private final static SysImplementation implementation;
|
||||
|
||||
|
|
@ -101,8 +98,9 @@ public final class Sys {
|
|||
loadLibrary(JNI_LIBRARY_NAME);
|
||||
|
||||
int native_jni_version = implementation.getJNIVersion();
|
||||
if (native_jni_version != JNI_VERSION)
|
||||
throw new LinkageError("Version mismatch: jar version is '" + JNI_VERSION +
|
||||
int required_version = implementation.getRequiredJNIVersion();
|
||||
if (native_jni_version != required_version)
|
||||
throw new LinkageError("Version mismatch: jar version is '" + required_version +
|
||||
"', native libary version is '" + native_jni_version + "'");
|
||||
implementation.setDebug(LWJGLUtil.DEBUG);
|
||||
}
|
||||
|
|
@ -112,9 +110,9 @@ public final class Sys {
|
|||
case LWJGLUtil.PLATFORM_LINUX:
|
||||
return new LinuxSysImplementation();
|
||||
case LWJGLUtil.PLATFORM_WINDOWS:
|
||||
return new org.lwjgl.WindowsSysImplementation();
|
||||
return new WindowsSysImplementation();
|
||||
case LWJGLUtil.PLATFORM_MACOSX:
|
||||
return new org.lwjgl.MacOSXSysImplementation();
|
||||
return new MacOSXSysImplementation();
|
||||
default:
|
||||
throw new IllegalStateException("Unsupported platform");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ package org.lwjgl;
|
|||
* $Id$
|
||||
*/
|
||||
interface SysImplementation {
|
||||
/**
|
||||
* Return the required version of the native library
|
||||
*/
|
||||
int getRequiredJNIVersion();
|
||||
|
||||
/**
|
||||
* Return the version of the native library
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -38,11 +38,15 @@ package org.lwjgl;
|
|||
* @version $Revision$
|
||||
* $Id$
|
||||
*/
|
||||
class WindowsSysImplementation extends DefaultSysImplementation {
|
||||
final class WindowsSysImplementation extends DefaultSysImplementation {
|
||||
static {
|
||||
Sys.initialize();
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public long getTimerResolution() {
|
||||
return 1000;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue