Added platform specific getJNIVersion implementations
This commit is contained in:
parent
100dfa86a6
commit
8b0b1b8b63
|
@ -177,6 +177,7 @@
|
|||
<!-- Generates the native headers from source files -->
|
||||
<target name="headers" description="invokes javah on java classes" depends="compile">
|
||||
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
|
||||
<class name="org.lwjgl.LinuxSysImplementation" />
|
||||
<class name="org.lwjgl.opengl.LinuxEvent" />
|
||||
<class name="org.lwjgl.opengl.LinuxMouse" />
|
||||
<class name="org.lwjgl.opengl.LinuxKeyboard" />
|
||||
|
@ -202,6 +203,7 @@
|
|||
</javah>
|
||||
|
||||
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
|
||||
<class name="org.lwjgl.MacOSXSysImplementation" />
|
||||
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
|
||||
<class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" />
|
||||
<class name="org.lwjgl.opengl.MacOSXPeerInfo" />
|
||||
|
|
|
@ -39,9 +39,6 @@ package org.lwjgl;
|
|||
* $Id$
|
||||
*/
|
||||
abstract class DefaultSysImplementation implements SysImplementation {
|
||||
/** Included to let native have easy access to Sys.JNI_VERSION */
|
||||
private final static int JNI_VERSION = Sys.JNI_VERSION;
|
||||
|
||||
public native int getJNIVersion();
|
||||
public native void setDebug(boolean debug);
|
||||
|
||||
|
|
|
@ -39,12 +39,14 @@ package org.lwjgl;
|
|||
* $Id$
|
||||
*/
|
||||
final class LinuxSysImplementation extends J2SESysImplementation {
|
||||
private final static int JNI_VERSION = 16;
|
||||
|
||||
static {
|
||||
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
return JNI_VERSION;
|
||||
}
|
||||
|
||||
public boolean openURL(final String url) {
|
||||
|
|
|
@ -45,13 +45,15 @@ import com.apple.eio.FileManager;
|
|||
* $Id$
|
||||
*/
|
||||
final class MacOSXSysImplementation extends J2SESysImplementation {
|
||||
private final static int JNI_VERSION = 16;
|
||||
|
||||
static {
|
||||
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
|
||||
Toolkit.getDefaultToolkit();
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
return JNI_VERSION;
|
||||
}
|
||||
|
||||
public boolean openURL(String url) {
|
||||
|
|
|
@ -39,12 +39,14 @@ package org.lwjgl;
|
|||
* $Id$
|
||||
*/
|
||||
final class WindowsSysImplementation extends DefaultSysImplementation {
|
||||
private final static int JNI_VERSION = 16;
|
||||
|
||||
static {
|
||||
Sys.initialize();
|
||||
}
|
||||
|
||||
public int getRequiredJNIVersion() {
|
||||
return 16;
|
||||
return JNI_VERSION;
|
||||
}
|
||||
|
||||
public long getTimerResolution() {
|
||||
|
|
|
@ -58,11 +58,6 @@ void putAttrib(attrib_list_t *list, int attrib) {
|
|||
list->current_index++;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
|
||||
(JNIEnv *env, jobject ignored) {
|
||||
return org_lwjgl_DefaultSysImplementation_JNI_VERSION;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug
|
||||
(JNIEnv *env, jobject ignored, jboolean enable) {
|
||||
debug = enable == JNI_TRUE ? true : false;
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "context.h"
|
||||
#include "org_lwjgl_opengl_LinuxDisplay.h"
|
||||
#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h"
|
||||
#include "org_lwjgl_LinuxSysImplementation.h"
|
||||
|
||||
#define ERR_MSG_SIZE 1024
|
||||
|
||||
|
@ -108,6 +109,11 @@ static jlong openDisplay(JNIEnv *env) {
|
|||
return (intptr_t)display_connection;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
|
||||
(JNIEnv *env, jobject ignored) {
|
||||
return org_lwjgl_LinuxSysImplementation_JNI_VERSION;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) {
|
||||
Display *disp = (Display *)(intptr_t)display_ptr;
|
||||
char err_msg_buffer[ERR_MSG_SIZE];
|
||||
|
|
|
@ -47,9 +47,15 @@
|
|||
//#import "display.h"
|
||||
#import "common_tools.h"
|
||||
#import "org_lwjgl_opengl_MacOSXDisplay.h"
|
||||
#import "org_lwjgl_MacOSXSysImplementation.h"
|
||||
|
||||
#define WAIT_DELAY 100
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
|
||||
(JNIEnv *env, jobject ignored) {
|
||||
return org_lwjgl_MacOSXSysImplementation_JNI_VERSION;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) {
|
||||
CGDisplayRestoreColorSyncSettings();
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "common_tools.h"
|
||||
#include "display.h"
|
||||
#include "org_lwjgl_opengl_WindowsDisplay.h"
|
||||
#include "org_lwjgl_WindowsSysImplementation.h"
|
||||
#include "context.h"
|
||||
|
||||
static HICON small_icon = NULL;
|
||||
|
@ -178,6 +179,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getAvailable
|
|||
return getAvailableDisplayModes(env);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
|
||||
(JNIEnv *env, jobject ignored) {
|
||||
return org_lwjgl_WindowsSysImplementation_JNI_VERSION;
|
||||
}
|
||||
|
||||
static void destroyWindow(JNIEnv *env) {
|
||||
jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(display_hwnd, GWLP_USERDATA);
|
||||
closeWindow(&display_hwnd, &display_hdc);
|
||||
|
|
Loading…
Reference in New Issue