From: <eli...@us...> - 2008-04-30 14:58:52
|
Revision: 3055 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3055&view=rev Author: elias_naur Date: 2008-04-30 07:58:47 -0700 (Wed, 30 Apr 2008) Log Message: ----------- Added platform specific getJNIVersion implementations Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/build.xml 2008-04-30 14:58:47 UTC (rev 3055) @@ -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" /> Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055) @@ -39,9 +39,6 @@ * $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); Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055) @@ -39,12 +39,14 @@ * $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) { Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055) @@ -45,13 +45,15 @@ * $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) { Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055) @@ -39,12 +39,14 @@ * $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() { Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/native/common/common_tools.c 2008-04-30 14:58:47 UTC (rev 3055) @@ -58,11 +58,6 @@ 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; Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c =================================================================== --- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2008-04-30 14:58:47 UTC (rev 3055) @@ -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 @@ 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]; Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m =================================================================== --- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2008-04-30 14:58:47 UTC (rev 3055) @@ -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(); } Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 14:34:54 UTC (rev 3054) +++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 14:58:47 UTC (rev 3055) @@ -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 @@ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |