You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(1) |
2
(14) |
3
(4) |
4
|
5
(3) |
6
(1) |
|
7
(9) |
8
(2) |
9
(4) |
10
|
11
(16) |
12
(21) |
13
(14) |
|
14
(12) |
15
(5) |
16
(6) |
17
|
18
(4) |
19
(4) |
20
(3) |
|
21
(2) |
22
(12) |
23
|
24
|
25
(8) |
26
|
27
(25) |
|
28
|
29
(2) |
30
(1) |
|
|
|
|
|
From: Elias N. <eli...@us...> - 2004-11-02 18:15:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28965/src/java/org/lwjgl/opengl Modified Files: Display.java Log Message: Added Display.processMessages(), providing a hook to only process native events and not swap buffers or poll input Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Display.java 2 Nov 2004 12:48:57 -0000 1.26 +++ Display.java 2 Nov 2004 18:15:39 -0000 1.27 @@ -426,8 +426,20 @@ } /** - * Update the window. This processes operating system events, and if the window is visible - * clears the dirty flag and swaps the buffers. + * Process operating system events. Call this to update the Display's state and make sure the + * input devices receive events. This method is called from update(), and should normally not be called by + * the application. + */ + public static void processMessages() { + if (!isCreated()) + throw new IllegalStateException("Cannot update uncreated window"); + + display_impl.update(); + } + + /** + * Update the window. This calls processMessages(), and if the window is visible + * clears the dirty flag and swaps the buffers and polls the input devices. * @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError() */ public static void update() { @@ -440,7 +452,7 @@ display_impl.swapBuffers(); } - display_impl.update(); + processMessages(); // Poll the input devices while we're here if (Mouse.isCreated()) { |
|
From: Elias N. <eli...@us...> - 2004-11-02 15:51:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29520/common Modified Files: common_tools.h extal.c extal.h extgl.c extgl.h Log Message: Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- common_tools.h 2 Nov 2004 15:09:40 -0000 1.27 +++ common_tools.h 2 Nov 2004 15:51:08 -0000 1.28 @@ -58,9 +58,11 @@ int attribs[ATTRIB_LIST_SIZE]; } attrib_list_t; -#ifndef _cplusplus +#ifndef __cplusplus +#ifndef bool typedef enum {false, true} bool; #endif +#endif #ifdef _WIN32 #define inline __inline Index: extal.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- extal.c 10 Sep 2004 09:56:26 -0000 1.15 +++ extal.c 2 Nov 2004 15:51:08 -0000 1.16 @@ -61,7 +61,7 @@ void* handleVorbisFile; void* handleOAL; #endif -#ifdef _AGL +#ifdef _MACOSX #include <mach-o/dyld.h> #include <stdlib.h> #include <string.h> @@ -83,7 +83,7 @@ #ifdef _X11 return dlsym(handleOAL, function); #endif -#ifdef _AGL +#ifdef _MACOSX char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char)); if (mac_symbol_name == NULL) return NULL; @@ -182,7 +182,7 @@ closeVorbisLibs(); } #endif -#ifdef _AGL +#ifdef _MACOSX char *lib_str = concatenate(path_str, "openal.dylib"); handleOAL = NSAddImage(lib_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); free(lib_str); @@ -211,7 +211,7 @@ } closeVorbisLibs(); #endif -#ifdef _AGL +#ifdef _MACOSX // Cannot remove the image #endif } Index: extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- extgl.h 4 Jul 2004 09:13:17 -0000 1.42 +++ extgl.h 2 Nov 2004 15:51:08 -0000 1.43 @@ -123,15 +123,15 @@ typedef double GLclampd; typedef void GLvoid; -#ifdef _AGL +#ifdef _MACOSX #include <Carbon/Carbon.h> #include <OpenGL/gliContext.h> #include <OpenGL/gliDispatch.h> #include <AGL/aglContext.h> -typedef struct __AGLRendererInfoRec *AGLRendererInfo; -typedef struct __AGLPixelFormatRec *AGLPixelFormat; -typedef struct __AGLContextRec *AGLContext; +typedef struct __MACOSXRendererInfoRec *AGLRendererInfo; +typedef struct __MACOSXPixelFormatRec *AGLPixelFormat; +typedef struct __MACOSXContextRec *AGLContext; typedef GDHandle AGLDevice; typedef CGrafPtr AGLDrawable; @@ -392,7 +392,7 @@ /************************************************************************/ -#endif /* _AGL */ +#endif /* _MACOSX */ #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 @@ -434,7 +434,7 @@ /* initializes everything, call this right after the rc is created. the function returns 0 if successful */ extern bool extgl_Open(void); -#ifdef _AGL +#ifdef _MACOSX extern bool extgl_InitAGL(JNIEnv *env); #endif extern void extgl_Close(void); Index: extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- extgl.c 10 Sep 2004 08:13:47 -0000 1.25 +++ extgl.c 2 Nov 2004 15:51:08 -0000 1.26 @@ -49,7 +49,7 @@ #include <dlfcn.h> #endif -#ifdef _AGL +#ifdef _MACOSX aglChoosePixelFormatPROC aglChoosePixelFormat = NULL; aglDestroyPixelFormatPROC aglDestroyPixelFormat = NULL; aglNextPixelFormatPROC aglNextPixelFormat = NULL; @@ -100,9 +100,9 @@ static glXGetProcAddressARBPROC glXGetProcAddressARB; #endif -#ifdef _AGL +#ifdef _MACOSX CFBundleRef opengl_bundle_ref = NULL; -CFBundleRef agl_bundle_ref = NULL; +//CFBundleRef agl_bundle_ref = NULL; #endif /* getProcAddress */ @@ -135,14 +135,14 @@ return t; #endif -#ifdef _AGL +#ifdef _MACOSX CFStringRef str = CFStringCreateWithCStringNoCopy(NULL, name, kCFStringEncodingUTF8, kCFAllocatorNull); void *func_pointer = CFBundleGetFunctionPointerForName(opengl_bundle_ref, str); if (func_pointer == NULL) { - func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str); - if (func_pointer == NULL) { +/* func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str); + if (func_pointer == NULL) {*/ printfDebug("Could not locate symbol %s\n", name); - } +// } } CFRelease(str); return func_pointer; @@ -157,7 +157,7 @@ return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); } -#ifdef _AGL +#ifdef _MACOSX // ------------------------- static CFBundleRef loadBundle(const Str255 frameworkName) { @@ -267,7 +267,7 @@ /*-----------------------------------------------------*/ /* AGL stuff BEGIN*/ /*-----------------------------------------------------*/ -#ifdef _AGL +#ifdef _MACOSX bool extgl_InitAGL(JNIEnv *env) { @@ -312,18 +312,18 @@ /* AGL stuff END*/ /*-----------------------------------------------------*/ -#ifdef _AGL +#ifdef _MACOSX bool extgl_Open(void) { if (opengl_bundle_ref != NULL) return true; opengl_bundle_ref = loadBundle("\pOpenGL.framework"); if (opengl_bundle_ref == NULL) return false; - agl_bundle_ref = loadBundle("\pAGL.framework"); +/* agl_bundle_ref = loadBundle("\pAGL.framework"); if (agl_bundle_ref == NULL) { aglUnloadFramework(opengl_bundle_ref); return false; - } + }*/ return true; } #endif @@ -371,9 +371,9 @@ FreeLibrary(lib_gl_handle); lib_gl_handle = NULL; #endif -#ifdef _AGL +#ifdef _MACOSX aglUnloadFramework(opengl_bundle_ref); - aglUnloadFramework(agl_bundle_ref); +// aglUnloadFramework(agl_bundle_ref); opengl_bundle_ref = NULL; #endif } Index: extal.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- extal.h 10 Sep 2004 09:56:26 -0000 1.28 +++ extal.h 2 Nov 2004 15:51:08 -0000 1.29 @@ -45,7 +45,7 @@ #include <altypes.h> #include <alctypes.h> #endif -#ifdef _AGL +#ifdef _MACOSX #include <OpenAL/alctypes.h> #include <OpenAL/altypes.h> #endif @@ -71,8 +71,8 @@ #define ALCAPIENTRY __cdecl #else - #ifdef _AGL - #if _AGL + #ifdef _MACOSX + #if _MACOSX typedef struct ALCdevice_struct ALCdevice; typedef struct ALCcontext_struct ALCcontext; |
|
From: Elias N. <eli...@us...> - 2004-11-02 15:51:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29520/common/fmod3 Modified Files: org_lwjgl_fmod3_FMOD.c Log Message: Index: org_lwjgl_fmod3_FMOD.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_fmod3_FMOD.c 24 Oct 2004 11:18:42 -0000 1.3 +++ org_lwjgl_fmod3_FMOD.c 2 Nov 2004 15:51:09 -0000 1.4 @@ -77,7 +77,7 @@ #ifdef _X11 lib_str = concatenate(path_str, "libfmod.so"); #endif -#ifdef _AGL +#ifdef _MACOSX lib_str = concatenate(path_str, "fmod_cfm.shlb"); #endif printfDebug("Testing '%s'\n", lib_str); |
|
From: Elias N. <eli...@us...> - 2004-11-02 15:09:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20504/common Modified Files: common_tools.h Log Message: Mac OS X compilation fixes Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- common_tools.h 2 Nov 2004 14:46:18 -0000 1.26 +++ common_tools.h 2 Nov 2004 15:09:40 -0000 1.27 @@ -58,7 +58,7 @@ int attribs[ATTRIB_LIST_SIZE]; } attrib_list_t; -#ifdef _cplusplus +#ifndef _cplusplus typedef enum {false, true} bool; #endif |
|
From: Elias N. <eli...@us...> - 2004-11-02 14:46:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15723/common Modified Files: common_tools.h Log Message: Fixed Mac OS X compilation of common Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- common_tools.h 2 Nov 2004 14:43:16 -0000 1.25 +++ common_tools.h 2 Nov 2004 14:46:18 -0000 1.26 @@ -58,7 +58,7 @@ int attribs[ATTRIB_LIST_SIZE]; } attrib_list_t; -#ifdef _X11 +#ifdef _cplusplus typedef enum {false, true} bool; #endif |
|
From: Elias N. <eli...@us...> - 2004-11-02 14:43:29
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15127/common/fmod3 Modified Files: org_lwjgl_fmod3_FMusic.c org_lwjgl_fmod3_FSound.c Log Message: Fixed Mac OS X compilation of common Index: org_lwjgl_fmod3_FMusic.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_fmod3_FMusic.c 10 Sep 2004 21:58:11 -0000 1.2 +++ org_lwjgl_fmod3_FMusic.c 2 Nov 2004 14:43:16 -0000 1.3 @@ -499,7 +499,7 @@ jfieldID highPriority; jint highPriorityValue; jmethodID priority; - + JavaVM *jvm = getJVM(); (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void*)&mixer_jnienv, NULL); // set to high priority Index: org_lwjgl_fmod3_FSound.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_fmod3_FSound.c 16 Oct 2004 01:02:10 -0000 1.3 +++ org_lwjgl_fmod3_FSound.c 2 Nov 2004 14:43:16 -0000 1.4 @@ -1870,7 +1870,7 @@ jfieldID highPriority; jint highPriorityValue; jmethodID priority; - + JavaVM jvm = getJVM(); (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void*)&stream_jnienv, NULL); // set to high priority |
|
From: Elias N. <eli...@us...> - 2004-11-02 14:43:29
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15127/common Modified Files: common_tools.c common_tools.h Log Message: Fixed Mac OS X compilation of common Index: common_tools.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- common_tools.c 24 Oct 2004 11:17:12 -0000 1.5 +++ common_tools.c 2 Nov 2004 14:43:16 -0000 1.6 @@ -43,7 +43,7 @@ static bool debug = false; static const char* VERSION = "0.93"; -JavaVM *jvm; +static JavaVM *jvm; void initAttribList(attrib_list_t *list) { list->current_index = 0; @@ -217,9 +217,14 @@ return (*env)->CallStaticBooleanMethod(env, booleanClass, getBoolean, property) ? true : false; } +JavaVM *getJVM() { + return jvm; +} + JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { jvm = vm; return JNI_VERSION_1_4; } + JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { } Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- common_tools.h 27 Sep 2004 13:20:27 -0000 1.24 +++ common_tools.h 2 Nov 2004 14:43:16 -0000 1.25 @@ -43,9 +43,6 @@ #include <jni.h> #include "org_lwjgl_Sys.h" -// shared VM instance -extern JavaVM *jvm; - #define EVENT_BUFFER_SIZE 256 #define ATTRIB_LIST_SIZE (256) @@ -61,10 +58,8 @@ int attribs[ATTRIB_LIST_SIZE]; } attrib_list_t; -#ifndef __cplusplus -typedef unsigned char bool; -#define true 1 -#define false 0 +#ifdef _X11 +typedef enum {false, true} bool; #endif #ifdef _WIN32 @@ -118,6 +113,7 @@ extern "C" { #endif +extern JavaVM *getJVM(); extern void initAttribList(attrib_list_t *list); extern void putAttrib(attrib_list_t *list, int attrib); |
|
From: Elias N. <eli...@us...> - 2004-11-02 13:16:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30917/src/native/win32 Modified Files: org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Display.cpp Log Message: Win32Display Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- org_lwjgl_input_Mouse.cpp 27 Sep 2004 13:43:34 -0000 1.64 +++ org_lwjgl_input_Mouse.cpp 2 Nov 2004 13:15:59 -0000 1.65 @@ -44,6 +44,7 @@ #include "Window.h" #include <dinput.h> #include "common_tools.h" +#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_input_Mouse.h" extern HINSTANCE dll_handle; // Handle to the LWJGL dll @@ -77,7 +78,7 @@ void CreateMouse(); void SetupMouse(); void InitializeMouseFields(); -void UpdateMouseFields(JNIEnv *env, jclass clsMouse, jobject coord_buffer_obj, jobject button_buffer_obj); +void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj); static bool putMouseEvent(jint button, jint state, jint dx, jint dy, jint dz) { jint event[] = {button, state, dx, -dy, dz}; @@ -95,18 +96,18 @@ accum_dx = accum_dy = 0; } -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasWheel(JNIEnv *, jclass) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_hasWheel(JNIEnv *env, jobject self) { return mHaswheel; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetButtonCount(JNIEnv *, jclass) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getButtonCount(JNIEnv *env, jobject self) { return mButtoncount; } /** * Called when the Mouse instance is to be created */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createMouse(JNIEnv *env, jobject self) { HRESULT hr; initEventQueue(&event_queue, 5); @@ -149,7 +150,7 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nEnableBuffer(JNIEnv * env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableMouseBuffer(JNIEnv * env, jobject self) { buffer_enabled = true; } @@ -251,8 +252,8 @@ } } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead - (JNIEnv * env, jclass clazz, jobject buffer_obj, jint buffer_position) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_readMouse + (JNIEnv * env, jobject self, jobject buffer_obj, jint buffer_position) { jint* buffer_ptr = (jint *)env->GetDirectBufferAddress(buffer_obj) + buffer_position; int buffer_size = (env->GetDirectBufferCapacity(buffer_obj))/sizeof(jint) - buffer_position; @@ -264,14 +265,14 @@ return copyEvents(&event_queue, buffer_ptr, buffer_size); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getNativeCursorCaps + (JNIEnv *env, jobject self) { return org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARENCY; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor - (JNIEnv *env, jclass clazz, jobject handle_buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setNativeCursor + (JNIEnv *env, jobject self, jobject handle_buffer) { if (mDIDevice == NULL) throwException(env, "null device!"); @@ -286,29 +287,29 @@ } } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMaxCursorSize + (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMinCursorSize + (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyMouse(JNIEnv *env, jobject self) { ShutdownMouse(); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass clazz, jobject coord_buffer_obj, jobject button_buffer_obj) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_pollMouse(JNIEnv * env, jobject self, jobject coord_buffer_obj, jobject button_buffer_obj) { mDIDevice->Acquire(); - UpdateMouseFields(env, clazz, coord_buffer_obj, button_buffer_obj); + UpdateMouseFields(env, coord_buffer_obj, button_buffer_obj); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nGrabMouse - (JNIEnv * env, jclass clazz, jboolean grab) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_grabMouse + (JNIEnv * env, jobject self, jboolean grab) { mDIDevice->Unacquire(); if(grab) { @@ -443,7 +444,7 @@ /** * Updates the fields on the Mouse */ -static void UpdateMouseFields(JNIEnv *env, jclass clsMouse, jobject coord_buffer_obj, jobject button_buffer_obj) { +static void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj) { HRESULT hRes; DIMOUSESTATE diMouseState; // State of Mouse Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- org_lwjgl_opengl_Display.cpp 24 Oct 2004 17:29:24 -0000 1.28 +++ org_lwjgl_opengl_Display.cpp 2 Nov 2004 13:15:59 -0000 1.29 @@ -46,7 +46,7 @@ #include "common_tools.h" #include "extgl_wgl.h" #include "display.h" -#include "org_lwjgl_opengl_Display.h" +#include "org_lwjgl_opengl_Win32Display.h" static bool oneShotInitialised = false; // Registers the LWJGL window class @@ -525,8 +525,8 @@ * Method: nSetTitle * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSetTitle - (JNIEnv * env, jclass clazz, jstring title_obj) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setTitle + (JNIEnv * env, jobject self, jstring title_obj) { const char * title = env->GetStringUTFChars(title_obj, NULL); SetWindowText(display_hwnd, title); @@ -538,8 +538,8 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nUpdate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_update + (JNIEnv * env, jobject self) { handleMessages(); } @@ -550,8 +550,8 @@ * Method: swapBuffers * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_swapBuffers - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_swapBuffers + (JNIEnv * env, jobject self) { isDirty = false; SwapBuffers(display_hdc); @@ -562,8 +562,8 @@ * Method: nIsDirty * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsDirty - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isDirty + (JNIEnv *env, jobject self) { bool result = isDirty; isDirty = false; return result ? JNI_TRUE : JNI_FALSE; @@ -574,8 +574,8 @@ * Method: nIsVisible * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsVisible - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible + (JNIEnv *env, jobject self) { return isMinimized ? JNI_FALSE : JNI_TRUE; } @@ -584,8 +584,8 @@ * Method: nIsCloseRequested * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsCloseRequested - (JNIEnv *, jclass) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isCloseRequested + (JNIEnv *env, jobject self) { bool saved = closerequested; closerequested = false; return saved; @@ -596,8 +596,8 @@ * Method: nIsActive * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsActive - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isActive + (JNIEnv *env, jobject self) { return isFocused; } @@ -606,8 +606,8 @@ * Method: nSetVSyncEnabled * Signature: (Z)Z */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSetVSyncEnabled - (JNIEnv * env, jclass clazz, jboolean sync) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setVSyncEnabled + (JNIEnv * env, jobject self, jboolean sync) { if (extgl_Extensions.WGL_EXT_swap_control) { if (sync == JNI_TRUE) { @@ -618,19 +618,19 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nMakeCurrent - (JNIEnv *env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_makeCurrent + (JNIEnv *env, jobject self) { BOOL result = wglMakeCurrent(display_hdc, display_hglrc); if (!result) throwException(env, "Could not make display context current"); } -JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Display_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz) { +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Win32Display_getAvailableDisplayModes(JNIEnv *env, jobject self) { return getAvailableDisplayModes(env); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, jclass clazz, jobject mode, jboolean fullscreen, jint x, jint y) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y) { closerequested = false; isMinimized = false; isFocused = true; @@ -668,35 +668,35 @@ SetFocus(display_hwnd); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nDestroyWindow(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyWindow(JNIEnv *env, jobject self) { closeWindow(display_hwnd, display_hdc); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jobject mode) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_switchDisplayMode(JNIEnv *env, jobject self, jobject mode) { switchDisplayMode(env, mode); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_resetDisplayMode(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_resetDisplayMode(JNIEnv *env, jobject self) { resetDisplayMode(env); } -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getGammaRampLength(JNIEnv *env, jobject self) { return getGammaRampLength(); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_setGammaRamp(JNIEnv *env, jclass clazz, jobject gamma_buffer) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setGammaRamp(JNIEnv *env, jobject self, jobject gamma_buffer) { setGammaRamp(env, gamma_buffer); } -JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Display_getAdapter(JNIEnv *env, jclass clazz) { +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_getAdapter(JNIEnv *env, jobject self) { return getAdapter(env); } -JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Display_getVersion(JNIEnv *env, jclass clazz) { +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_getVersion(JNIEnv *env, jobject self) { return getVersion(env); } -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Display_init(JNIEnv *env, jclass clazz) { +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_init(JNIEnv *env, jobject self) { return initDisplay(env); } @@ -727,7 +727,7 @@ return true; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_createContext(JNIEnv *env, jclass clazz, jobject pixel_format) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createContext(JNIEnv *env, jobject self, jobject pixel_format) { HWND dummy_hwnd = createWindow(0, 0, 1, 1, false, false); if (dummy_hwnd == NULL) { throwException(env, "Failed to create the window."); @@ -775,7 +775,7 @@ closeWindow(dummy_hwnd, dummy_hdc); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_destroyContext(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyContext(JNIEnv *env, jobject self) { wglMakeCurrent(NULL, NULL); // Delete the rendering context @@ -786,7 +786,7 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nReshape(JNIEnv *env, jclass clazz, jint x, jint y, jint width, jint height) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_reshape(JNIEnv *env, jobject self, jint x, jint y, jint width, jint height) { if (isFullScreen) { return; } Index: org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- org_lwjgl_input_Keyboard.cpp 18 Oct 2004 20:29:52 -0000 1.37 +++ org_lwjgl_input_Keyboard.cpp 2 Nov 2004 13:15:59 -0000 1.38 @@ -43,6 +43,7 @@ #define DIRECTINPUT_VERSION 0x0300 #include "Window.h" #include <dinput.h> +#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_input_Keyboard.h" #include "common_tools.h" @@ -57,13 +58,8 @@ static bool useUnicode; -/* - * Class: org_lwjgl_input_Keyboard - * Method: nCreate - * Signature: ()Z - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createKeyboard + (JNIEnv * env, jobject self) { // Create input HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); @@ -112,8 +108,8 @@ * Method: nDestroy * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyKeyboard + (JNIEnv * env, jobject self) { // Release keyboard if (lpdiKeyboard != NULL) { @@ -134,8 +130,8 @@ * Method: nPoll * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll - (JNIEnv * env, jclass clazz, jobject buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_pollKeyboard + (JNIEnv * env, jobject self, jobject buffer) { HRESULT ret; do { @@ -166,8 +162,8 @@ lpdiKeyboard->GetDeviceState((DWORD)buffer_size, keyboardBuffer); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead - (JNIEnv * env, jclass clazz, jobject buffer_obj, jint buffer_position) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_readKeyboard + (JNIEnv * env, jobject self, jobject buffer_obj, jint buffer_position) { static DIDEVICEOBJECTDATA rgdod[KEYBOARD_BUFFER_SIZE]; wchar_t transBufUnicode[KEYBOARD_BUFFER_SIZE]; @@ -272,8 +268,8 @@ * Method: nEnableTranslation * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation - (JNIEnv *, jclass) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableTranslation + (JNIEnv *env, jobject self) { // We can't do translation on DOS boxes it seems so we'll have to throw a wobbler // here: @@ -290,12 +286,12 @@ translationEnabled = true; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableKeyboardBuffer + (JNIEnv * env, jobject self) { } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_isStateKeySet(JNIEnv *env, jobject self, jint key) { int state = org_lwjgl_input_Keyboard_STATE_UNKNOWN; switch(key) { |
|
From: Elias N. <eli...@us...> - 2004-11-02 12:49:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25939/src/native/linux Added Files: org_lwjgl_opengl_Display.c Log Message: Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation --- NEW FILE: org_lwjgl_opengl_Display.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Display.c,v 1.9 2004/11/02 12:49:41 elias_naur Exp $ * * Linux specific display functions. * * @author elias_naur <eli...@us...> * @version $Revision: 1.9 $ */ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <jni.h> #include "common_tools.h" #include "extgl.h" #include "extgl_glx.h" #include "Window.h" #include "display.h" #include "org_lwjgl_opengl_LinuxDisplay.h" #define USEGLX13 extgl_Extensions.GLX13 #define ERR_MSG_SIZE 1024 typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } MotifWmHints; #define MWM_HINTS_DECORATIONS (1L << 1) typedef enum {FULLSCREEN_LEGACY, FULLSCREEN_NETWM, WINDOWED} window_mode; static GLXContext context = NULL; // OpenGL rendering context static GLXFBConfig *configs = NULL; static GLXWindow glx_window; static XVisualInfo *vis_info = NULL; static Atom delete_atom; static Colormap cmap; static Window current_win; static window_mode current_window_mode; static int current_height; static int current_width; static bool input_released; static bool dirty; static bool vsync_enabled; static bool minimized; static bool focused; static bool closerequested; static bool grab; static int current_screen; static Display *display_connection = NULL; static int display_connection_usage = 0; static bool async_x_error; static char error_message[ERR_MSG_SIZE]; static Atom warp_atom; GLXFBConfig getCurrentGLXFBConfig(void) { return configs[0]; } GLXContext getCurrentGLXContext(void) { return context; } int getCurrentScreen(void) { return current_screen; } bool checkXError(JNIEnv *env) { XSync(getDisplay(), False); if (async_x_error) { async_x_error = false; if (env != NULL) throwException(env, error_message); else printfDebug(error_message); return false; } else return true; } static int errorHandler(Display *disp, XErrorEvent *error) { char err_msg_buffer[ERR_MSG_SIZE]; XGetErrorText(disp, error->error_code, err_msg_buffer, ERR_MSG_SIZE); err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; snprintf(error_message, ERR_MSG_SIZE, "X Error - serial: %d, error_code: %s, request_code: %d, minor_code: %d", (int)error->serial, err_msg_buffer, (int)error->request_code, (int)error->minor_code); error_message[ERR_MSG_SIZE - 1] = '\0'; async_x_error = true; return 0; } Display *getDisplay(void) { return display_connection; } Display *incDisplay(JNIEnv *env) { if (display_connection_usage == 0) { async_x_error = false; XSetErrorHandler(errorHandler); display_connection = XOpenDisplay(NULL); if (display_connection == NULL) { if (env != NULL) throwException(env, "Could not open X display connection"); else printfDebug("Could not open X display connection\n"); return NULL; } warp_atom = XInternAtom(display_connection, "_LWJGL_WARP", False); } async_x_error = false; display_connection_usage++; return display_connection; } Atom getWarpAtom(void) { return warp_atom; } void decDisplay(void) { display_connection_usage--; if (display_connection_usage == 0) { XCloseDisplay(display_connection); display_connection = NULL; } } static void waitMapped(Window win) { XEvent event; do { XMaskEvent(getDisplay(), StructureNotifyMask, &event); } while ((event.type != MapNotify) || (event.xmap.event != win)); } static void updateInputGrab(void) { updatePointerGrab(); updateKeyboardGrab(); } static void setRepeatMode(int mode) { XKeyboardControl repeat_mode; repeat_mode.auto_repeat_mode = mode; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { printfDebug("Could not open display to set repeat mode\n"); return; } XChangeKeyboardControl(disp, KBAutoRepeatMode, &repeat_mode); XCloseDisplay(disp); } static void setDecorations(int dec) { Atom motif_hints_atom = XInternAtom(getDisplay(), "_MOTIF_WM_HINTS", False); MotifWmHints motif_hints; motif_hints.flags = MWM_HINTS_DECORATIONS; motif_hints.decorations = dec; XChangeProperty (getDisplay(), getCurrentWindow(), motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); } bool releaseInput(void) { if (isLegacyFullscreen() || input_released) return false; input_released = true; setRepeatMode(AutoRepeatModeDefault); updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); resetDisplayMode(getCurrentScreen(), true); } return true; } static void acquireInput(void) { if (isLegacyFullscreen() || !input_released) return; input_released = false; setRepeatMode(AutoRepeatModeOff); updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { temporaryRestoreMode(getCurrentScreen()); } } bool isLegacyFullscreen(void) { return current_window_mode == FULLSCREEN_LEGACY; } bool shouldGrab(void) { return !input_released && grab; } void setGrab(bool new_grab) { if (new_grab != grab) { grab = new_grab; updateInputGrab(); } } static void checkInput(void) { Window win; int revert_mode; XGetInputFocus(getDisplay(), &win, &revert_mode); if (win == current_win) { acquireInput(); focused = true; } } void handleMessages(void) { XEvent event; Window win; int revert_mode; while (XPending(getDisplay()) > 0) { XNextEvent(getDisplay(), &event); if (XFilterEvent(&event, None) == True) continue; switch (event.type) { case ClientMessage: if (event.xclient.message_type == warp_atom) { handleWarpEvent(&(event.xclient)); } else if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom)) closerequested = true; break; case FocusOut: XGetInputFocus(getDisplay(), &win, &revert_mode); if (win != current_win) { releaseInput(); focused = false; } break; case FocusIn: checkInput(); break; case MapNotify: dirty = true; minimized = false; break; case UnmapNotify: dirty = true; minimized = true; break; case Expose: dirty = true; break; case ButtonPress: handleButtonPress(&(event.xbutton)); break; case ButtonRelease: handleButtonRelease(&(event.xbutton)); break; case MotionNotify: handlePointerMotion(&(event.xmotion)); break; case KeyPress: case KeyRelease: handleKeyEvent(&(event.xkey)); break; } } } static void setWindowTitle(const char *title) { XStoreName(getDisplay(), current_win, title); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setTitle(JNIEnv * env, jobject this, jstring title_obj) { const char * title = (*env)->GetStringUTFChars(env, title_obj, NULL); setWindowTitle(title); (*env)->ReleaseStringUTFChars(env, title_obj, title); } static void destroyWindow(void) { if (USEGLX13) glXDestroyWindow(getDisplay(), glx_window); XDestroyWindow(getDisplay(), current_win); XFreeColormap(getDisplay(), cmap); setRepeatMode(AutoRepeatModeDefault); } static bool isNetWMFullscreenSupported() { unsigned long nitems; Atom actual_type; int actual_format; unsigned long bytes_after; Atom *supported_list; Atom netwm_supported_atom = XInternAtom(getDisplay(), "_NET_SUPPORTED", False); int result = XGetWindowProperty(getDisplay(), RootWindow(getDisplay(), getCurrentScreen()), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); if (result != Success) { printfDebug("Unable to query _NET_SUPPORTED window property\n"); return false; } Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False); bool supported = false; unsigned long i; for (i = 0; i < nitems; i++) { if (fullscreen_atom == supported_list[i]) { supported = true; break; } } XFree(supported_list); return supported; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reshape(JNIEnv *env, jobject this, jint x, jint y, jint width, jint height) { XMoveWindow(getDisplay(), getCurrentWindow(), x, y); } static bool createWindow(JNIEnv* env, int x, int y, int width, int height) { bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); dirty = true; focused = true; minimized = false; closerequested = false; vsync_enabled = false; grab = false; Window root_win; Window win; XSetWindowAttributes attribs; int attribmask; input_released = false; current_width = width; current_height = height; root_win = RootWindow(getDisplay(), getCurrentScreen()); cmap = XCreateColormap(getDisplay(), root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; attribs.background_pixel = 0xFF000000; attribs.win_gravity = NorthWestGravity; attribmask = CWColormap | CWBackPixel | CWEventMask | CWWinGravity; if (isLegacyFullscreen()) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } win = XCreateWindow(getDisplay(), root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); if (!checkXError(env)) { XFreeColormap(getDisplay(), cmap); return false; } printfDebug("Created window\n"); current_win = win; if (current_window_mode != WINDOWED || undecorated) { // Use Motif decoration hint property and hope the window manager respects them setDecorations(0); } XSizeHints * size_hints = XAllocSizeHints(); size_hints->flags = PMinSize | PMaxSize; size_hints->min_width = width; size_hints->max_width = width; size_hints->min_height = height; size_hints->max_height = height; XSetWMNormalHints(getDisplay(), win, size_hints); XFree(size_hints); delete_atom = XInternAtom(getDisplay(), "WM_DELETE_WINDOW", False); XSetWMProtocols(getDisplay(), win, &delete_atom, 1); if (current_window_mode == FULLSCREEN_NETWM) { Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False); XChangeProperty(getDisplay(), getCurrentWindow(), XInternAtom(getDisplay(), "_NET_WM_STATE", False), XInternAtom(getDisplay(), "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1); } XMapRaised(getDisplay(), win); waitMapped(win); XClearWindow(getDisplay(), win); setRepeatMode(AutoRepeatModeOff); if (!checkXError(env)) { destroyWindow(); return false; } return true; } Window getCurrentWindow(void) { return current_win; } int getWindowWidth(void) { return current_width; } int getWindowHeight(void) { return current_height; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_update (JNIEnv *env, jobject this) { handleMessages(); } static bool makeCurrent(void) { if (USEGLX13) return glXMakeContextCurrent(getDisplay(), glx_window, glx_window, context) == True; else return glXMakeCurrent(getDisplay(), getCurrentWindow(), context) == True; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_makeCurrent (JNIEnv *env, jobject this) { if (!makeCurrent()) throwException(env, "Could not make display context current"); } int convertToBPE(int bpp) { int bpe; switch (bpp) { case 32: case 24: bpe = 8; break; case 16: /* Fall through */ default: bpe = 4; break; } return bpe; } GLXContext getCurrentContext(void) { return context; } static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); int bpe = convertToBPE(bpp); int accum_bpe = convertToBPE(accum_bpp); attrib_list_t attrib_list; initAttribList(&attrib_list); putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, GLX_RGBA_BIT); putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False); putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type); putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); 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); putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, stereo ? True : False); if (samples > 0 && extgl_Extensions.GLX_ARB_multisample) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); } putAttrib(&attrib_list, None); putAttrib(&attrib_list, None); int num_formats = 0; GLXFBConfig* configs = glXChooseFBConfig(getDisplay(), getCurrentScreen(), attrib_list.attribs, &num_formats); if (num_formats > 0) { return configs; } else { if (configs != NULL) XFree(configs); return NULL; } } GLXFBConfig *chooseVisualGLX13(JNIEnv *env, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int bpp; if (use_display_bpp) { bpp = XDefaultDepthOfScreen(XScreenOfDisplay(getDisplay(), getCurrentScreen())); GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, pixel_format, bpp, drawable_type, double_buffer); if (configs != NULL) return configs; else bpp = 16; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return chooseVisualGLX13FromBPP(env, pixel_format, bpp, drawable_type, double_buffer); } static XVisualInfo *chooseVisualGLX(JNIEnv *env, jobject pixel_format) { int bpp = XDefaultDepthOfScreen(XScreenOfDisplay(getDisplay(), getCurrentScreen())); jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); int bpe = convertToBPE(bpp); int accum_bpe = convertToBPE(accum_bpp); attrib_list_t attrib_list; initAttribList(&attrib_list); putAttrib(&attrib_list, GLX_RGBA); putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); 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) putAttrib(&attrib_list, GLX_STEREO); if (samples > 0 && extgl_Extensions.GLX_ARB_multisample) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); } putAttrib(&attrib_list, None); return glXChooseVisual(getDisplay(), getCurrentScreen(), attrib_list.attribs); } static void dumpVisualInfo(XVisualInfo *vis_info) { int alpha, depth, stencil, r, g, b; int sample_buffers = 0; int samples = 0; glXGetConfig(getDisplay(), vis_info, GLX_RED_SIZE, &r); glXGetConfig(getDisplay(), vis_info, GLX_GREEN_SIZE, &g); glXGetConfig(getDisplay(), vis_info, GLX_BLUE_SIZE, &b); glXGetConfig(getDisplay(), vis_info, GLX_ALPHA_SIZE, &alpha); glXGetConfig(getDisplay(), vis_info, GLX_DEPTH_SIZE, &depth); glXGetConfig(getDisplay(), vis_info, GLX_STENCIL_SIZE, &stencil); if (extgl_Extensions.GLX_ARB_multisample) { glXGetConfig(getDisplay(), vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); glXGetConfig(getDisplay(), vis_info, GLX_SAMPLES_ARB, &samples); } printfDebug("Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d\n", r, g, b, alpha, depth, stencil, sample_buffers, samples); } static void destroyContext(void) { if (USEGLX13) { XFree(configs); configs = NULL; } XFree(vis_info); vis_info = NULL; glXDestroyContext(getDisplay(), context); context = NULL; } static bool initWindowGLX13(JNIEnv *env, jobject pixel_format) { configs = chooseVisualGLX13(env, pixel_format, true, GLX_WINDOW_BIT, true); if (configs == NULL) { throwException(env, "Could not find a matching pixel format"); return false; } context = glXCreateNewContext(getDisplay(), configs[0], GLX_RGBA_TYPE, NULL, True); if (context == NULL) { XFree(configs); throwException(env, "Could not create a GLX context"); return false; } jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Window.allowSoftwareOpenGL"); if (!allow_software_acceleration && (glXIsDirect(getDisplay(), context) == False)) { glXDestroyContext(getDisplay(), context); XFree(configs); throwException(env, "Could not create a direct GLX context"); return false; } vis_info = glXGetVisualFromFBConfig(getDisplay(), configs[0]); if (vis_info == NULL) { glXDestroyContext(getDisplay(), context); XFree(configs); throwException(env, "Could not get visual from FB config"); return false; } if (!checkXError(env)) { glXDestroyContext(getDisplay(), context); XFree(configs); XFree(vis_info); return false; } return true; } static bool initWindowGLX(JNIEnv *env, jobject pixel_format) { vis_info = chooseVisualGLX(env, pixel_format); if (vis_info == NULL) { throwException(env, "Could not find a matching pixel format"); return false; } if (isDebugEnabled()) dumpVisualInfo(vis_info); context = glXCreateContext(getDisplay(), vis_info, NULL, True); if (context == NULL) { XFree(vis_info); throwException(env, "Could not create a GLX context"); return false; } jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Window.allowSoftwareOpenGL"); if (!allow_software_acceleration && glXIsDirect(getDisplay(), context) == False) { glXDestroyContext(getDisplay(), context); XFree(vis_info); throwException(env, "Could not create a direct GLX context"); return false; } if (!checkXError(env)) { glXDestroyContext(getDisplay(), context); XFree(vis_info); return false; } return true; } JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getAvailableDisplayModes(JNIEnv *env, jobject this) { return getAvailableDisplayModes(env, getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_switchDisplayMode(JNIEnv *env, jobject this, jobject mode) { switchDisplayMode(env, mode, getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetDisplayMode(JNIEnv *env, jobject this) { resetDisplayMode(getCurrentScreen(), false); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getGammaRampLength(JNIEnv *env, jobject this) { return (jint)getGammaRampLength(getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) { setGammaRamp(env, gamma_buffer, getCurrentScreen()); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_init(JNIEnv *env, jobject this) { return initDisplay(env, getCurrentScreen()); } JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getAdapter(JNIEnv *env , jobject this) { return NULL; } JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getVersion(JNIEnv *env, jobject this) { return NULL; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_createContext(JNIEnv *env, jobject this, jobject pixel_format) { Display *disp = incDisplay(env); if (disp == NULL) { return; } current_screen = XDefaultScreen(disp); if (!extgl_InitGLX(env, disp, current_screen)) { decDisplay(); throwException(env, "Could not init GLX"); return; } if (USEGLX13) { initWindowGLX13(env, pixel_format); } else { initWindowGLX(env, pixel_format); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_destroyContext(JNIEnv *env, jobject this) { destroyContext(); decDisplay(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_createWindow(JNIEnv *env, jobject this, jobject mode, jboolean fullscreen, int x, int y) { bool current_fullscreen = fullscreen == JNI_TRUE; if (current_fullscreen) { if (getCurrentDisplayModeExtension() == XRANDR && isNetWMFullscreenSupported()) current_window_mode = FULLSCREEN_NETWM; else current_window_mode = FULLSCREEN_LEGACY; } else current_window_mode = WINDOWED; jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); bool window_created = createWindow(env, x, y, width, height); if (!window_created) { return; } if (isDebugEnabled()) dumpVisualInfo(vis_info); if (USEGLX13) glx_window = glXCreateWindow(getDisplay(), configs[0], getCurrentWindow(), NULL); if (!makeCurrent() || !checkXError(env)) { glXDestroyWindow(getDisplay(), glx_window); destroyWindow(); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_destroyWindow(JNIEnv *env, jobject this) { destroyWindow(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_swapBuffers(JNIEnv * env, jobject this) { dirty = false; if (USEGLX13) glXSwapBuffers(getDisplay(), glx_window); else glXSwapBuffers(getDisplay(), getCurrentWindow()); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isDirty (JNIEnv *env, jobject this) { bool result = dirty; dirty = false; return result ? JNI_TRUE : JNI_FALSE; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isVisible (JNIEnv *env, jobject this) { return minimized ? JNI_FALSE : JNI_TRUE; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isCloseRequested (JNIEnv *env, jobject this) { bool saved = closerequested; closerequested = false; return saved; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isActive (JNIEnv *env, jobject this) { return focused ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setVSyncEnabled (JNIEnv *env, jobject this, jboolean sync) { if (extgl_Extensions.GLX_SGI_swap_control) { bool vsync = sync == JNI_TRUE ? true : false; if (vsync != vsync_enabled) { int interval = vsync ? 1 : 0; glXSwapIntervalSGI(interval); vsync_enabled = vsync; } } } |
|
From: Elias N. <eli...@us...> - 2004-11-02 12:49:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25783/src/java/org/lwjgl/opengl Modified Files: Display.java Added Files: DisplayImplementation.java LinuxDisplay.java Win32Display.java Log Message: Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation --- NEW FILE: Win32Display.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; final class Win32Display implements DisplayImplementation { public native void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; public native void destroyWindow(); public native void switchDisplayMode(DisplayMode mode) throws LWJGLException; public native void resetDisplayMode(); public native int getGammaRampLength(); public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; public native String getAdapter(); public native String getVersion(); public native DisplayMode init(); public native void setTitle(String title); public native boolean isCloseRequested(); public native boolean isVisible(); public native boolean isActive(); public native boolean isDirty(); public native void swapBuffers(); public native void makeCurrent() throws LWJGLException; public native void createContext(PixelFormat pixel_format) throws LWJGLException; public native void destroyContext(); public native void update(); public native void setVSyncEnabled(boolean sync); public native void reshape(int x, int y, int width, int height); public native DisplayMode[] getAvailableDisplayModes(); /* Mouse */ public native boolean hasWheel(); public native int getButtonCount(); public native void createMouse(); public native void destroyMouse(); public native void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); public native void enableMouseBuffer() throws LWJGLException; public native int readMouse(IntBuffer buffer, int buffer_position); public native void grabMouse(boolean grab); public native int getNativeCursorCaps(); public native void setNativeCursor(ByteBuffer handle) throws LWJGLException; public native int getMinCursorSize(); public native int getMaxCursorSize(); /* Keyboard */ public native void createKeyboard() throws LWJGLException; public native void destroyKeyboard(); public native void pollKeyboard(ByteBuffer keyDownBuffer); public native int readKeyboard(IntBuffer buffer, int buffer_position); public native void enableTranslation() throws LWJGLException; public native void enableKeyboardBuffer() throws LWJGLException; public native int isStateKeySet(int key); } --- NEW FILE: DisplayImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; public interface DisplayImplementation { public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; public void destroyWindow(); public void switchDisplayMode(DisplayMode mode) throws LWJGLException; /** * Reset the display mode to whatever it was when LWJGL was initialized. * Fails silently. */ public void resetDisplayMode(); /** * Return the length of the gamma ramp arrays. Returns 0 if gamma settings are * unsupported. * * @return the length of each gamma ramp array, or 0 if gamma settings are unsupported. */ public int getGammaRampLength(); /** * Native method to set the gamma ramp. */ public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; /** * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", * "Radeon9700". If the adapter cannot be determined, this function returns null. * @return a String */ public String getAdapter(); /** * Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, * this function returns null. * @return a String */ public String getVersion(); /** * Initialize and return the current display mode. */ public DisplayMode init(); /** * Native implementation of setTitle(). This will read the window's title member * and stash it in the native title of the window. */ public void setTitle(String title); public boolean isCloseRequested(); public boolean isVisible(); public boolean isActive(); public boolean isDirty(); /** * Swap double buffers. */ public void swapBuffers(); /** * Make the window the current rendering context for GL calls. */ public void makeCurrent() throws LWJGLException; /** * Create the native OpenGL context. * @throws LWJGLException */ public void createContext(PixelFormat pixel_format) throws LWJGLException; public void destroyContext(); /** * Updates the windows internal state. This must be called at least once per video frame * to handle window close requests, moves, paints, etc. */ public void update(); public void setVSyncEnabled(boolean sync); public void reshape(int x, int y, int width, int height); /** * Native method for getting displaymodes */ public DisplayMode[] getAvailableDisplayModes(); /* * Mouse methods */ /** Native query of wheel support */ public boolean hasWheel(); /** Native query of button count */ public int getButtonCount(); /** * Native method to create the mouse. * * @return true if the mouse was created */ public void createMouse(); /** * Native method the destroy the mouse */ public void destroyMouse(); /** * Native method to poll the mouse */ public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); /** * Native method to enable the buffer * @return the event buffer, * or null if no buffer can be allocated */ public void enableMouseBuffer() throws LWJGLException; /** * Native method to read the keyboard buffer * @return the total number of events read. */ public int readMouse(IntBuffer buffer, int buffer_position); public void grabMouse(boolean grab); /** * Native function to determine native cursor support */ public int getNativeCursorCaps(); /** Native method to set the native cursor */ public void setNativeCursor(ByteBuffer handle) throws LWJGLException; /** Native method returning the minimum cursor size */ public int getMinCursorSize(); /** Native method returning the maximum cursor size */ public int getMaxCursorSize(); /* * Keyboard methods */ /** * Native method to create the keyboard */ public void createKeyboard() throws LWJGLException; /** * Native method to destroy the keyboard */ public void destroyKeyboard(); /** * Native method to poll the keyboard. * * @param keyDownBufferAddress the address of a 256-byte buffer to place * key states in. */ public void pollKeyboard(ByteBuffer keyDownBuffer); /** * Native method to read the keyboard buffer * @return the total number of events read. */ public int readKeyboard(IntBuffer buffer, int buffer_position); /** * Native method to enable the translation buffer */ public void enableTranslation() throws LWJGLException; /** * Native method to enable the buffer * @return the event buffer, * or null if no buffer can be allocated */ public void enableKeyboardBuffer() throws LWJGLException; public int isStateKeySet(int key); } --- NEW FILE: LinuxDisplay.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; final class LinuxDisplay implements DisplayImplementation { public native void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; public native void destroyWindow(); public native void switchDisplayMode(DisplayMode mode) throws LWJGLException; public native void resetDisplayMode(); public native int getGammaRampLength(); public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; public native String getAdapter(); public native String getVersion(); public native DisplayMode init(); public native void setTitle(String title); public native boolean isCloseRequested(); public native boolean isVisible(); public native boolean isActive(); public native boolean isDirty(); public native void swapBuffers(); public native void makeCurrent() throws LWJGLException; public native void createContext(PixelFormat pixel_format) throws LWJGLException; public native void destroyContext(); public native void update(); public native void setVSyncEnabled(boolean sync); public native void reshape(int x, int y, int width, int height); public native DisplayMode[] getAvailableDisplayModes(); /* Mouse */ public native boolean hasWheel(); public native int getButtonCount(); public native void createMouse(); public native void destroyMouse(); public native void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); public native void enableMouseBuffer() throws LWJGLException; public native int readMouse(IntBuffer buffer, int buffer_position); public native void grabMouse(boolean grab); public native int getNativeCursorCaps(); public native void setNativeCursor(ByteBuffer handle) throws LWJGLException; public native int getMinCursorSize(); public native int getMaxCursorSize(); /* Keyboard */ public native void createKeyboard() throws LWJGLException; public native void destroyKeyboard(); public native void pollKeyboard(ByteBuffer keyDownBuffer); public native int readKeyboard(IntBuffer buffer, int buffer_position); public native void enableTranslation() throws LWJGLException; public native void enableKeyboardBuffer() throws LWJGLException; public native int isStateKeySet(int key); } Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- Display.java 1 Nov 2004 23:13:30 -0000 1.25 +++ Display.java 2 Nov 2004 12:48:57 -0000 1.26 @@ -56,21 +56,14 @@ public final class Display { - /** The current display mode, if created */ - private static DisplayMode current_mode; + /** The display implementor */ + private final static DisplayImplementation display_impl; /** The initial display mode */ private final static DisplayMode initial_mode; - static { - Sys.initialize(); - current_mode = initial_mode = init(); - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - reset(); - } - }); - } + /** The current display mode, if created */ + private static DisplayMode current_mode; /** Timer for sync() */ private static long timeNow, timeThen; @@ -96,6 +89,38 @@ /** A unique context object, so we can track different contexts between creates() and destroys() */ private static Display context; + static { + Sys.initialize(); + display_impl = createDisplayImplementation(); + current_mode = initial_mode = display_impl.init(); + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + reset(); + } + }); + } + + private final static DisplayImplementation createDisplayImplementation() { + String class_name; + String os_name = System.getProperty("os.name"); + if (os_name.startsWith("Linux")) { + class_name = "org.lwjgl.opengl.LinuxDisplay"; + } else if (os_name.startsWith("Windows")) { + class_name = "org.lwjgl.opengl.Win32Display"; + } else + throw new IllegalStateException("The platform " + os_name + " is not supported"); + try { + Class display_class = Class.forName(class_name); + return (DisplayImplementation)display_class.newInstance(); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InstantiationException e) { + throw new RuntimeException(e); + } + } + /** * Only constructed by ourselves */ @@ -113,7 +138,7 @@ * @return an array of all display modes the system reckons it can handle. */ public static DisplayMode[] getAvailableDisplayModes() { - DisplayMode[] unfilteredModes = nGetAvailableDisplayModes(); + DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes(); if (unfilteredModes == null) { return new DisplayMode[0]; @@ -132,11 +157,6 @@ } /** - * Native method for getting displaymodes - */ - private static native DisplayMode[] nGetAvailableDisplayModes(); - - /** * Return the current display mode, as set by setDisplayMode(). * @return The current display mode */ @@ -165,8 +185,8 @@ switchDisplayMode(); createWindow(); } catch (LWJGLException e) { - destroyContext(); - resetDisplayMode(); + display_impl.destroyContext(); + display_impl.resetDisplayMode(); throw e; } } @@ -179,14 +199,12 @@ private static void createWindow() throws LWJGLException { x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x)); y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y)); - nCreateWindow(current_mode, fullscreen, (fullscreen) ? 0 : x, (fullscreen) ? 0 : y); - nSetTitle(title); + display_impl.createWindow(current_mode, fullscreen, (fullscreen) ? 0 : x, (fullscreen) ? 0 : y); + setTitle(title); initControls(); - nSetVSyncEnabled(vsync); + setVSyncEnabled(vsync); } - private static native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; - private static void destroyWindow() { // Automatically destroy keyboard, mouse, and controller if (Mouse.isCreated()) { @@ -198,25 +216,15 @@ if (Controller.isCreated()) { Controller.destroy(); } - nDestroyWindow(); + display_impl.destroyWindow(); } - private static native void nDestroyWindow(); - private static void switchDisplayMode() throws LWJGLException { if (!current_mode.isFullscreen()) throw new LWJGLException("The current DisplayMode instance cannot be used for fullscreen mode"); - nSwitchDisplayMode(current_mode); + display_impl.switchDisplayMode(current_mode); } - private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException; - - /** - * Reset the display mode to whatever it was when LWJGL was initialized. - * Fails silently. - */ - private static native void resetDisplayMode(); - /** * Set the display configuration to the specified gamma, brightness and contrast. * The configuration changes will be reset when destroy() is called. @@ -233,7 +241,7 @@ throw new IllegalArgumentException("Invalid brightness value"); if (contrast < 0.0f) throw new IllegalArgumentException("Invalid contrast value"); - int rampSize = getGammaRampLength(); + int rampSize = display_impl.getGammaRampLength(); if (rampSize == 0) { throw new LWJGLException("Display configuration not supported"); } @@ -253,38 +261,11 @@ rampEntry = 0.0f; gammaRamp.put(i, rampEntry); } - setGammaRamp(gammaRamp); + display_impl.setGammaRamp(gammaRamp); Sys.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); } /** - * Return the length of the gamma ramp arrays. Returns 0 if gamma settings are - * unsupported. - * - * @return the length of each gamma ramp array, or 0 if gamma settings are unsupported. - */ - private static native int getGammaRampLength(); - - /** - * Native method to set the gamma ramp. - */ - private static native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; - - /** - * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", - * "Radeon9700". If the adapter cannot be determined, this function returns null. - * @return a String - */ - public static native String getAdapter(); - - /** - * Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, - * this function returns null. - * @return a String - */ - public static native String getVersion(); - - /** * Synchronize the display to a capped frame rate. Note that we are being "smart" about the * desired results in our implementation; we automatically subtract 1 from the desired framerate * to prevent just missing the frame time if vsync is set. @@ -324,11 +305,6 @@ } /** - * Initialize and return the current display mode. - */ - private static native DisplayMode init(); - - /** * @return the X coordinate of the window (always 0 for fullscreen) */ /*public static int getX() { @@ -371,12 +347,12 @@ if (fullscreen) { switchDisplayMode(); } else { - resetDisplayMode(); + display_impl.resetDisplayMode(); } createWindow(); } catch (LWJGLException e) { - destroyContext(); - resetDisplayMode(); + display_impl.destroyContext(); + display_impl.resetDisplayMode(); throw e; } } @@ -399,51 +375,39 @@ } title = newTitle; if (isCreated()) - nSetTitle(title); + display_impl.setTitle(title); } /** - * Native implementation of setTitle(). This will read the window's title member - * and stash it in the native title of the window. - */ - private static native void nSetTitle(String title); - - /** * @return true if the user or operating system has asked the window to close */ public static boolean isCloseRequested() { if (!isCreated()) throw new IllegalStateException("Cannot determine close requested state of uncreated window"); - nUpdate(); - return nIsCloseRequested(); + display_impl.update(); + return display_impl.isCloseRequested(); } - private static native boolean nIsCloseRequested(); - /** * @return true if the window is visible, false if not */ public static boolean isVisible() { if (!isCreated()) throw new IllegalStateException("Cannot determine minimized state of uncreated window"); - nUpdate(); - return nIsVisible(); + display_impl.update(); + return display_impl.isVisible(); } - private static native boolean nIsVisible(); - /** * @return true if window is active, that is, the foreground display of the operating system. */ public static boolean isActive() { if (!isCreated()) throw new IllegalStateException("Cannot determine focused state of uncreated window"); - nUpdate(); - return nIsActive(); + display_impl.update(); + return display_impl.isActive(); } - private static native boolean nIsActive(); - /** * Determine if the window's contents have been damaged by external events. * If you are writing a straightforward game rendering loop and simply paint @@ -457,12 +421,10 @@ public static boolean isDirty() { if (!isCreated()) throw new IllegalStateException("Cannot determine dirty state of uncreated window"); - nUpdate(); - return nIsDirty(); + display_impl.update(); + return display_impl.isDirty(); } - private static native boolean nIsDirty(); - /** * Update the window. This processes operating system events, and if the window is visible * clears the dirty flag and swaps the buffers. @@ -475,10 +437,10 @@ // We paint only when the window is visible or dirty if (isVisible() || isDirty()) { Util.checkGLError(); - swapBuffers(); + display_impl.swapBuffers(); } - nUpdate(); + display_impl.update(); // Poll the input devices while we're here if (Mouse.isCreated()) { @@ -494,27 +456,17 @@ } /** - * Swap double buffers. - */ - private static native void swapBuffers(); - - /** * Make the Display the current rendering context for GL calls. Also initialize native stubs. * @throws LWJGLException If the context could not be made current */ public static void makeCurrent() throws LWJGLException { if (!isCreated()) throw new IllegalStateException("No window created to make current"); - nMakeCurrent(); + display_impl.makeCurrent(); GLContext.useContext(context); } /** - * Make the window the current rendering context for GL calls. - */ - private static native void nMakeCurrent() throws LWJGLException; - - /** * Create the OpenGL context. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context @@ -549,14 +501,14 @@ try { GLContext.loadOpenGLLibrary(); try { - createContext(pixel_format); + display_impl.createContext(pixel_format); try { context = new Display(); createWindow(); makeCurrent(); initContext(); } catch (LWJGLException e) { - destroyContext(); + display_impl.destroyContext(); context = null; throw e; } @@ -565,19 +517,11 @@ throw e; } } catch (LWJGLException e) { - resetDisplayMode(); + display_impl.resetDisplayMode(); throw e; } } - /** - * Create the native OpenGL context. - * @throws LWJGLException - */ - private static native void createContext(PixelFormat pixel_format) throws LWJGLException; - - private static native void destroyContext(); - private static void initContext() { // Put the window into orthographic projection mode with 1:1 pixel ratio. // We haven't used GLU here to do this to avoid an unnecessary dependency. @@ -589,6 +533,10 @@ GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight()); } + public static DisplayImplementation getImplementation() { + return display_impl; + } + private static void initControls() { // Automatically create mouse, keyboard and controller if (!Boolean.getBoolean("org.lwjgl.opengl.Display.noinput")) { @@ -641,7 +589,7 @@ } destroyWindow(); - destroyContext(); + display_impl.destroyContext(); GLContext.unloadOpenGLLibrary(); context = null; try { @@ -657,7 +605,7 @@ * in the static constructor */ private static void reset() { - resetDisplayMode(); + display_impl.resetDisplayMode(); current_mode = initial_mode; } @@ -676,12 +624,6 @@ } /** - * Updates the windows internal state. This must be called at least once per video frame - * to handle window close requests, moves, paints, etc. - */ - private static native void nUpdate(); - - /** * Enable or disable vertical monitor synchronization. This call is a best-attempt at changing * the vertical refresh synchronization of the monitor, and is not guaranteed to be successful. * @param sync true to synchronize; false to ignore synchronization @@ -689,11 +631,9 @@ public static void setVSyncEnabled(boolean sync) { vsync = sync; if (isCreated()) - nSetVSyncEnabled(vsync); + display_impl.setVSyncEnabled(vsync); } - private static native void nSetVSyncEnabled(boolean sync); - /** * Set the window's location. This is a no-op on fullscreen windows. * The window is clamped to remain entirely on the screen. If you attempt @@ -705,17 +645,34 @@ if (fullscreen) { return; } - - // offset if already created - if(isCreated()) { - x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x)); - y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y)); - nReshape(x, y, current_mode.getWidth(), current_mode.getHeight()); - } - // cache position - Display.x = x; - Display.y = y; + // offset if already created + if(isCreated()) { + x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x)); + y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y)); + display_impl.reshape(x, y, current_mode.getWidth(), current_mode.getHeight()); + } + + // cache position + Display.x = x; + Display.y = y; + } + + /** + * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", + * "Radeon9700". If the adapter cannot be determined, this function returns null. + * @return a String + */ + public static String getAdapter() { + return display_impl.getAdapter(); + } + + /** + * Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, + * this function returns null. + * @return a String + */ + public static String getVersion() { + return display_impl.getVersion(); } - private static native void nReshape(int x, int y, int width, int height); } |
|
From: Elias N. <eli...@us...> - 2004-11-02 12:49:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25783/src/native/linux Modified Files: org_lwjgl_input_Keyboard.c org_lwjgl_input_Mouse.c Removed Files: org_lwjgl_opengl_Display.c Log Message: Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation Index: org_lwjgl_input_Keyboard.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_input_Keyboard.c 18 Oct 2004 12:26:30 -0000 1.10 +++ org_lwjgl_input_Keyboard.c 2 Nov 2004 12:48:58 -0000 1.11 @@ -49,6 +49,7 @@ #include "Window.h" #include "common_tools.h" #include "org_lwjgl_input_Keyboard.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" #define KEYBOARD_BUFFER_SIZE 50 #define KEYBOARD_SIZE 256 @@ -117,8 +118,8 @@ XSetICFocus(xic); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_createKeyboard + (JNIEnv * env, jobject this) { Display *disp = incDisplay(env); if (disp == NULL) @@ -169,8 +170,8 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_destroyKeyboard + (JNIEnv * env, jobject this) { closeUnicodeStructs(); ungrabKeyboard(); @@ -282,27 +283,27 @@ bufferEvent(event); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll(JNIEnv * env, jclass clazz, jobject buffer) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_pollKeyboard(JNIEnv * env, jobject this, jobject buffer) { unsigned char *new_keyboard_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, buffer); handleMessages(); memcpy(new_keyboard_buffer, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); } -JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead(JNIEnv * env, jclass clazz, jobject buffer, jint buffer_position) { +JNIEXPORT int JNICALL Java_org_lwjgl_opengl_LinuxDisplay_readKeyboard(JNIEnv * env, jobject this, jobject buffer, jint buffer_position) { handleMessages(); jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; return copyEvents(&event_queue, buffer_ptr + buffer_position, buffer_size); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_enableTranslation(JNIEnv *env, jobject this) { translation_enabled = true; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer(JNIEnv * env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_enableKeyboardBuffer(JNIEnv * env, jobject this) { buffer_enabled = true; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isStateKeySet(JNIEnv *env, jobject this, jint key) { return org_lwjgl_input_Keyboard_STATE_UNKNOWN; } --- org_lwjgl_opengl_Display.c DELETED --- Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_input_Mouse.c 13 Oct 2004 10:55:49 -0000 1.16 +++ org_lwjgl_input_Mouse.c 2 Nov 2004 12:48:58 -0000 1.17 @@ -49,6 +49,7 @@ #include "common_tools.h" #include "display.h" #include "org_lwjgl_input_Mouse.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" #define NUM_BUTTONS 3 @@ -188,8 +189,8 @@ XWarpPointer(getDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, center_x, center_y); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps - (JNIEnv *env, jclass clazz) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getNativeCursorCaps + (JNIEnv *env, jobject this) { int caps = 0; Display *disp = incDisplay(env); if (disp == NULL) @@ -204,7 +205,7 @@ return caps; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor(JNIEnv *env, jclass clazz, jobject cursor_handle) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setNativeCursor(JNIEnv *env, jobject this, jobject cursor_handle) { if (cursor_handle != NULL) { Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, cursor_handle); current_cursor = *cursor; @@ -213,8 +214,8 @@ updateCursor(); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getMinCursorSize + (JNIEnv *env, jobject this) { unsigned int width_return = 0; unsigned int height_return = 0; @@ -222,8 +223,8 @@ return width_return > height_return ? width_return : height_return; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getMaxCursorSize + (JNIEnv *env, jobject this) { unsigned int width_return = 0; unsigned int height_return = 0; @@ -231,11 +232,11 @@ return width_return > height_return ? height_return : width_return; } -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasWheel(JNIEnv *env , jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasWheel(JNIEnv *env , jobject this) { return JNI_TRUE; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetButtonCount(JNIEnv *env, jclass clazz) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getButtonCount(JNIEnv *env, jobject this) { return NUM_BUTTONS; } @@ -243,8 +244,8 @@ resetCursor(getWindowWidth()/2, transformY(getWindowHeight()/2)); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_createMouse + (JNIEnv * env, jobject this) { Display *disp = incDisplay(env); if (disp == NULL) @@ -267,8 +268,8 @@ initEventQueue(&event_queue, 5); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_destroyMouse + (JNIEnv * env, jobject this) { ungrabPointer(); XFreeCursor(getDisplay(), blank_cursor); @@ -355,7 +356,7 @@ doHandlePointerMotion(event->x_root, event->y_root, event->x, event->y); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass clazz, jobject coord_buffer_obj, jobject button_buffer_obj) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_pollMouse(JNIEnv * env, jobject this, jobject coord_buffer_obj, jobject button_buffer_obj) { int *coords = (int *)(*env)->GetDirectBufferAddress(env, coord_buffer_obj); int coords_length = (*env)->GetDirectBufferCapacity(env, coord_buffer_obj); unsigned char *buttons_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, button_buffer_obj); @@ -377,18 +378,18 @@ buttons_buffer[i] = buttons[i]; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nEnableBuffer(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_enableMouseBuffer(JNIEnv *env, jobject this) { buffer_enabled = true; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead(JNIEnv *env, jclass clazz, jobject buffer, jint buffer_position) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_readMouse(JNIEnv *env, jobject this, jobject buffer, jint buffer_position) { jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; handleMessages(); return copyEvents(&event_queue, buffer_ptr + buffer_position, buffer_size); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nGrabMouse(JNIEnv * env, jclass clazz, jboolean new_grab) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_grabMouse(JNIEnv * env, jobject this, jboolean new_grab) { Window root_return, child_return; int root_x, root_y, win_x, win_y; unsigned int mask_return; |
|
From: Elias N. <eli...@us...> - 2004-11-02 12:49:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25783/src/java/org/lwjgl/input Modified Files: Keyboard.java Mouse.java Log Message: Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation Index: Keyboard.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- Keyboard.java 22 Sep 2004 11:08:05 -0000 1.52 +++ Keyboard.java 2 Nov 2004 12:48:57 -0000 1.53 @@ -290,16 +290,11 @@ initialize(); if (created) return; - nCreate(); + Display.getImplementation().createKeyboard(); created = true; } /** - * Native method to create the keyboard - */ - private static native void nCreate() throws LWJGLException; - - /** * @return true if the keyboard has been created */ public static boolean isCreated() { @@ -313,15 +308,10 @@ if (!created) return; created = false; - nDestroy(); + Display.getImplementation().destroyKeyboard(); } /** - * Native method to destroy the keyboard - */ - private static native void nDestroy(); - - /** * Polls the keyboard for its current state. Access the polled values using the * <code>isKeyDown</code> method. * By using this method, it is possible to "miss" keyboard keys if you don't @@ -346,33 +336,19 @@ public static void poll() { if (!created) throw new IllegalStateException("Keyboard must be created before you can poll the device"); - nPoll(keyDownBuffer); + Display.getImplementation().pollKeyboard(keyDownBuffer); if (readBuffer != null) read(); } private static void read() { readBuffer.compact(); - int numEvents = nRead(readBuffer, readBuffer.position()); + int numEvents = Display.getImplementation().readKeyboard(readBuffer, readBuffer.position()); readBuffer.position(readBuffer.position() + numEvents*EVENT_SIZE); readBuffer.flip(); } /** - * Native method to poll the keyboard. - * - * @param keyDownBufferAddress the address of a 256-byte buffer to place - * key states in. - */ - private static native void nPoll(ByteBuffer keyDownBuffer); - - /** - * Native method to read the keyboard buffer - * @return the total number of events read. - */ - private static native int nRead(IntBuffer buffer, int buffer_position); - - /** * Enable keyboard translation. Must be called after the keyboard is created, * and keyboard buffering must be enabled. */ @@ -381,16 +357,11 @@ throw new IllegalStateException("Keyboard must be created before you can read events"); if (readBuffer == null) throw new IllegalStateException("Event buffering must be enabled before you can read events"); - nEnableTranslation(); + Display.getImplementation().enableTranslation(); translationEnabled = true; } /** - * Native method to enable the translation buffer - */ - private static native void nEnableTranslation() throws LWJGLException; - - /** * Enable keyboard buffering. Must be called after the keyboard is created. */ public static void enableBuffer() throws LWJGLException { @@ -398,17 +369,10 @@ throw new IllegalStateException("Keyboard must be created before you can enable buffering"); readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE); readBuffer.limit(0); - nEnableBuffer(); + Display.getImplementation().enableKeyboardBuffer(); } /** - * Native method to enable the buffer - * @return the event buffer, - * or null if no buffer can be allocated - */ - private static native void nEnableBuffer() throws LWJGLException; - - /** * Checks to see if a key is down. * @param key Keycode to check * @return true if the key is down according to the last poll() @@ -442,10 +406,9 @@ public static int isStateKeySet(int key) { if (!created) throw new IllegalStateException("Keyboard must be created before you can query key state"); - return nisStateKeySet(key); + return Display.getImplementation().isStateKeySet(key); } - private static native int nisStateKeySet(int key); - + /** * Gets a key's name * @param key The key Index: Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- Mouse.java 22 Sep 2004 11:08:20 -0000 1.66 +++ Mouse.java 2 Nov 2004 12:48:57 -0000 1.67 @@ -174,15 +174,10 @@ * @return A bit mask with native cursor capabilities. */ public static int getNativeCursorCaps() { - return nGetNativeCursorCaps(); + return Display.getImplementation().getNativeCursorCaps(); } /** - * Native function to determine native cursor support - */ - private static native int nGetNativeCursorCaps(); - - /** * Binds a native cursor. If the cursor argument is null, the * native cursor is disabled, as if native cursors were not supported. * @@ -204,18 +199,15 @@ currentCursor = cursor; if (isCreated()) { if (currentCursor != null) { - nSetNativeCursor(currentCursor.getHandle()); + Display.getImplementation().setNativeCursor(currentCursor.getHandle()); currentCursor.setTimeout(); } else { - nSetNativeCursor(null); + Display.getImplementation().setNativeCursor(null); } } return oldCursor; } - /** Native method to set the native cursor */ - private static native void nSetNativeCursor(ByteBuffer handle) throws LWJGLException; - /** * Gets the minimum size of a native cursor. Can only be called if * The Mouse is created and cursor caps includes at least @@ -224,12 +216,9 @@ * @return the maximum size of a native cursor */ public static int getMinCursorSize() { - return nGetMinCursorSize(); + return Display.getImplementation().getMinCursorSize(); } - /** Native method returning the minimum cursor size */ - private static native int nGetMinCursorSize(); - /** * Gets the maximum size of a native cursor. Can only be called if * The Mouse is created and cursor caps includes at least @@ -238,12 +227,9 @@ * @return the maximum size of a native cursor */ public static int getMaxCursorSize() { - return nGetMaxCursorSize(); + return Display.getImplementation().getMaxCursorSize(); } - /** Native method returning the maximum cursor size */ - private static native int nGetMaxCursorSize(); - /** * Static initialization */ @@ -281,31 +267,18 @@ if (!initialized) initialize(); if (created) { return; } - nCreate(); - hasWheel = nHasWheel(); + Display.getImplementation().createMouse(); + hasWheel = Display.getImplementation().hasWheel(); created = true; - + // set mouse buttons - buttonCount = nGetButtonCount(); + buttonCount = Display.getImplementation().getButtonCount(); buttons = BufferUtils.createByteBuffer(buttonCount); coord_buffer = BufferUtils.createIntBuffer(3); setNativeCursor(currentCursor); setGrabbed(isGrabbed); } - /** Native query of wheel support */ - private static native boolean nHasWheel(); - - /** Native query of button count */ - private static native int nGetButtonCount(); - - /** - * Native method to create the mouse. - * - * @return true if the mouse was created - */ - private static native void nCreate(); - /** * @return true if the mouse has been created */ @@ -329,15 +302,10 @@ buttons = null; coord_buffer = null; - nDestroy(); + Display.getImplementation().destroyMouse(); } /** - * Native method the destroy the mouse - */ - private static native void nDestroy(); - - /** * Polls the mouse for its current state. Access the polled values using the * get<value> methods. * By using this method, it is possible to "miss" mouse click events if you don't @@ -363,7 +331,7 @@ */ public static void poll() { if (!created) throw new IllegalStateException("Mouse must be created before you can poll it"); - nPoll(coord_buffer, buttons); + Display.getImplementation().pollMouse(coord_buffer, buttons); int poll_dx = coord_buffer.get(0); int poll_dy = coord_buffer.get(1); @@ -410,17 +378,12 @@ private static void read() { readBuffer.compact(); - int numEvents = nRead(readBuffer, readBuffer.position()); + int numEvents = Display.getImplementation().readMouse(readBuffer, readBuffer.position()); readBuffer.position(readBuffer.position() + numEvents * EVENT_SIZE); readBuffer.flip(); } /** - * Native method to poll the mouse - */ - private static native void nPoll(IntBuffer coord_buffer, ByteBuffer buttons); - - /** * See if a particular mouse button is down. * * @param button The index of the button you wish to test (0..getButtonCount-1) @@ -465,23 +428,10 @@ if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering"); readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE); readBuffer.limit(0); - nEnableBuffer(); + Display.getImplementation().enableMouseBuffer(); } /** - * Native method to enable the buffer - * @return the event buffer, - * or null if no buffer can be allocated - */ - private static native void nEnableBuffer() throws LWJGLException; - - /** - * Native method to read the keyboard buffer - * @return the total number of events read. - */ - private static native int nRead(IntBuffer buffer, int buffer_position); - - /** * Gets the next mouse event. You can query which button caused the event by using * <code>getEventButton()</code> (if any). To get the state of that key, for that event, use * <code>getEventButtonState</code>. To get the current mouse delta values use <code>getEventDX()</code>, @@ -638,13 +588,11 @@ public static void setGrabbed(boolean grab) { isGrabbed = grab; if (isCreated()) { - nGrabMouse(isGrabbed); + Display.getImplementation().grabMouse(isGrabbed); resetMouse(); } } - private static native void nGrabMouse(boolean grab); - /** * Updates the cursor, so that animation can be changed if needed. * This method is called automatically by the window on its update, and |
|
From: Elias N. <eli...@us...> - 2004-11-02 12:49:14
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25783 Modified Files: build.xml Log Message: Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- build.xml 26 Oct 2004 19:50:06 -0000 1.38 +++ build.xml 2 Nov 2004 12:48:56 -0000 1.39 @@ -4,8 +4,8 @@ <!-- Global properties for build --> <!-- ================================================================== --> <property name="lwjgl.src" value="./src" /> - <property name="lwjgl.src.headers" value="${lwjgl.src}/native/common" /> - <property name="lwjgl.src.native" value="./src/native" /> + <property name="lwjgl.src.native" value="${lwjgl.src}/native" /> + <property name="lwjgl.src.headers" value="${lwjgl.src.native}/common" /> <property name="lwjgl.bin" value="./bin" /> <property name="lwjgl.lib" value="./libs" /> <property name="lwjgl.dist" value="./dist" /> @@ -137,7 +137,7 @@ <antcall target="-initialize" /> <antcall target="compile" /> <antcall target="compile_native" /> - <antcall target="-jars" /> + <antcall target="jars" /> <antcall target="-distribution_application" /> <antcall target="javadoc" /> <antcall target="-distribution_javadoc" /> @@ -159,7 +159,7 @@ <antcall target="-initialize"/> <antcall target="compile"/> <antcall target="compile_native"/> - <antcall target="-jars"/> + <antcall target="jars"/> <antcall target="-distribution_application"/> </target> @@ -254,7 +254,7 @@ </target> <!-- Packages the java files --> - <target name="-jars"> + <target name="jars"> <!-- Create lwjgl.jar --> <jar destfile="${lwjgl.lib}/lwjgl.jar" taskname="lwjgl.jar"> <fileset refid="lwjgl.fileset" /> @@ -301,7 +301,7 @@ </target> <!-- Creates a distribution from the compiled files --> - <target name="-distribution" depends="-jars"> + <target name="-distribution" depends="jars"> <antcall target="-distribution_application" /> <antcall target="-distribution_javadoc" /> <antcall target="-distribution_source" /> @@ -325,6 +325,13 @@ <!-- Generates the native headers from source files --> <target name="headers" description="invokes javah on java classes" depends="compile"> + <!-- platform specific classes --> + <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> + <class name="org.lwjgl.opengl.LinuxDisplay" /> + </javah> + <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/win32" force="yes"> + <class name="org.lwjgl.opengl.Win32Display" /> + </javah> <!-- lwjgl --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> <class name="org.lwjgl.Sys" /> @@ -342,7 +349,6 @@ <class name="org.lwjgl.openal.eax.EAXListenerProperties" /> <class name="org.lwjgl.opengl.GLContext" /> - <class name="org.lwjgl.opengl.Display" /> <class name="org.lwjgl.opengl.Pbuffer" /> </javah> |
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11102 Removed Files: org_lwjgl_Sys.h org_lwjgl_input_Controller.h org_lwjgl_input_Cursor.h org_lwjgl_input_Keyboard.h org_lwjgl_input_Mouse.h org_lwjgl_openal_AL.h org_lwjgl_openal_eax_EAX.h org_lwjgl_openal_eax_EAX20.h org_lwjgl_openal_eax_EAXBufferProperties.h org_lwjgl_openal_eax_EAXListenerProperties.h org_lwjgl_opengl_Display.h org_lwjgl_opengl_GLContext.h org_lwjgl_opengl_Pbuffer.h Log Message: Remove autogenerated headers --- org_lwjgl_openal_AL.h DELETED --- --- org_lwjgl_openal_eax_EAX20.h DELETED --- --- org_lwjgl_input_Mouse.h DELETED --- --- org_lwjgl_openal_eax_EAXBufferProperties.h DELETED --- --- org_lwjgl_input_Cursor.h DELETED --- --- org_lwjgl_input_Controller.h DELETED --- --- org_lwjgl_opengl_Pbuffer.h DELETED --- --- org_lwjgl_opengl_GLContext.h DELETED --- --- org_lwjgl_opengl_Display.h DELETED --- --- org_lwjgl_openal_eax_EAX.h DELETED --- --- org_lwjgl_input_Keyboard.h DELETED --- --- org_lwjgl_openal_eax_EAXListenerProperties.h DELETED --- --- org_lwjgl_Sys.h DELETED --- |