|
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; |