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
(3) |
2
|
3
(1) |
4
|
|
5
|
6
(5) |
7
(11) |
8
(7) |
9
|
10
(3) |
11
(12) |
|
12
|
13
(2) |
14
(7) |
15
(3) |
16
(3) |
17
|
18
|
|
19
|
20
(11) |
21
(5) |
22
(12) |
23
(10) |
24
(8) |
25
(4) |
|
26
(1) |
27
|
28
(13) |
29
(1) |
30
|
31
|
|
|
From: Elias N. <eli...@us...> - 2003-10-06 15:28:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv23467/src/native/macosx Modified Files: org_lwjgl_input_Keyboard.cpp org_lwjgl_opengl_Window.cpp Log Message: Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_input_Keyboard.cpp 6 Oct 2003 14:00:43 -0000 1.8 +++ org_lwjgl_input_Keyboard.cpp 6 Oct 2003 15:28:12 -0000 1.9 @@ -47,6 +47,29 @@ #define KEYBOARD_SIZE 256 #define KEY_EVENT_BACKLOG 40 +static unsigned char key_buf[KEYBOARD_SIZE]; +static unsigned char key_map[KEYBOARD_SIZE]; + +static void handleKey(UInt32 key_code, unsigned char state) { + if (key_code >= KEYBOARD_SIZE) { +#ifdef _DEBUG + printf("Key code too large %x\n", (unsigned int)key_code); +#endif + return; + } + lock(); + unsigned char mapped_code = key_map[key_code]; + unsigned char old_state = key_buf[mapped_code]; + if (old_state != state) { +if (state == 1) + printf("key down, key %x\n", key_code); +else + printf("key up, key %x\n", key_code); + key_buf[mapped_code] = state; + } + unlock(); +} + static pascal OSStatus doKeyDown(EventHandlerCallRef next_handler, EventRef event, void *user_data) { UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); @@ -56,7 +79,7 @@ #endif return eventNotHandledErr; } -printf("key down, key %d\n", key_code); + handleKey(key_code, 1); return noErr; } @@ -69,109 +92,85 @@ #endif return eventNotHandledErr; } -printf("key up, key %d\n", key_code); + handleKey(key_code, 0); return noErr; } -bool registerKeyboardHandler(JNIEnv* env, WindowRef win_ref) { - EventTypeSpec event_types[1]; - EventHandlerUPP handler_upp = NewEventHandlerUPP(doKeyUp); - event_types[0].eventClass = kEventClassKeyboard; - event_types[0].eventKind = kEventRawKeyUp; - OSStatus err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); - DisposeEventHandlerUPP(handler_upp); - if (noErr != err) { - throwException(env, "Could not register window event handler"); - return false; +static void handleModifier(UInt32 modifier_bit_mask, UInt32 modifier_bit, unsigned char key_code) { + bool key_down = (modifier_bit_mask & modifier_bit) == modifier_bit; + unsigned char key_state = key_down ? 1 : 0; + handleKey(key_code, key_state); +} + +static pascal OSStatus doKeyModifier(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + UInt32 modifier_bits; + OSStatus err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier_bits), NULL, &modifier_bits); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not get event key code\n"); +#endif + return eventNotHandledErr; } - handler_upp = NewEventHandlerUPP(doKeyDown); - event_types[0].eventClass = kEventClassKeyboard; - event_types[0].eventKind = kEventRawKeyDown; - err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); + handleModifier(modifier_bits, controlKey, 0x1d); + handleModifier(modifier_bits, rightControlKey, 0x9d); + handleModifier(modifier_bits, shiftKey, 0x2a); + handleModifier(modifier_bits, rightShiftKey, 0x36); + handleModifier(modifier_bits, optionKey, 0x38); + handleModifier(modifier_bits, rightOptionKey, 0xb8); + handleModifier(modifier_bits, cmdKey, 0xdb); + handleModifier(modifier_bits, alphaLock, 0x3a); + handleModifier(modifier_bits, kEventKeyModifierNumLockMask, 0x45); + //handleModifier(modifier_bits, rightCmdKey, 0xdc); + return noErr; +} + +static bool registerHandler(JNIEnv* env, WindowRef win_ref, EventHandlerProcPtr func, UInt32 event_kind) { + EventTypeSpec event_type; + EventHandlerUPP handler_upp = NewEventHandlerUPP(func); + event_type.eventClass = kEventClassKeyboard; + event_type.eventKind = event_kind; + OSStatus err = InstallWindowEventHandler(win_ref, handler_upp, 1, &event_type, NULL, NULL); DisposeEventHandlerUPP(handler_upp); if (noErr != err) { throwException(env, "Could not register window event handler"); - return false; + return true; } - return true; + return false; } -/* - * Class: org_lwjgl_input_Keyboard - * Method: initIDs - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_initIDs - (JNIEnv * env, jclass clazz) -{ +bool registerKeyboardHandler(JNIEnv* env, WindowRef win_ref) { + bool error = registerHandler(env, win_ref, doKeyUp, kEventRawKeyUp); + error = error || registerHandler(env, win_ref, doKeyDown, kEventRawKeyDown); + error = error || registerHandler(env, win_ref, doKeyModifier, kEventRawKeyModifiersChanged); + return !error; } -/* - * 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_input_Keyboard_initIDs(JNIEnv * env, jclass clazz) { } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nDestroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy - (JNIEnv * env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate(JNIEnv * env, jclass clazz) { + memset(key_buf, 0, KEYBOARD_SIZE*sizeof(unsigned char)); } -/* - * Class: org_lwjgl_input_Keyboard - * 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_input_Keyboard_nDestroy(JNIEnv * env, jclass clazz) { } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nRead - * Signature: (I)V - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead - (JNIEnv * env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll(JNIEnv * env, jclass clazz, jobject buffer) { + unsigned char *new_keyboard_buffer = (unsigned char *)env->GetDirectBufferAddress(buffer); + lock(); + memcpy(new_keyboard_buffer, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); + unlock(); } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nEnableTranslation - * Signature: ()I - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation - (JNIEnv *env, jclass clazz) -{ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead(JNIEnv * env, jclass clazz) { } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nEnableBuffer - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer - (JNIEnv * env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation(JNIEnv *env, jclass clazz) { } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nisStateKeySet - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) -{ - return org_lwjgl_input_Keyboard_STATE_UNKNOWN; +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer(JNIEnv * env, jclass clazz) { +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) { + return org_lwjgl_input_Keyboard_STATE_UNKNOWN; } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Window.cpp 6 Oct 2003 14:00:43 -0000 1.12 +++ org_lwjgl_opengl_Window.cpp 6 Oct 2003 15:28:12 -0000 1.13 @@ -107,7 +107,7 @@ return noErr; } -static bool registerWindowHandler(JNIEnv* env, EventHandlerProcPtr func, UInt32 event_kind) { +static bool registerWindowHandler(JNIEnv* env, WindowRef win_ref, EventHandlerProcPtr func, UInt32 event_kind) { EventTypeSpec event_type; OSStatus err; EventHandlerUPP handler_upp = NewEventHandlerUPP(func); @@ -124,11 +124,11 @@ static bool registerEventHandlers(JNIEnv *env) { bool error; - error = registerWindowHandler(env, doQuit, kEventWindowClose); - error = error || registerWindowHandler(env, doActivate, kEventWindowActivated); - error = error || registerWindowHandler(env, doDeactivate, kEventWindowDeactivated); - error = error || registerWindowHandler(env, doMiniaturized, kEventWindowCollapsed); - error = error || registerWindowHandler(env, doMaximize, kEventWindowExpanded); + error = registerWindowHandler(env, win_ref, doQuit, kEventWindowClose); + error = error || registerWindowHandler(env, win_ref, doActivate, kEventWindowActivated); + error = error || registerWindowHandler(env, win_ref, doDeactivate, kEventWindowDeactivated); + error = error || registerWindowHandler(env, win_ref, doMiniaturized, kEventWindowCollapsed); + error = error || registerWindowHandler(env, win_ref, doMaximize, kEventWindowExpanded); if (error) return false; else @@ -143,11 +143,11 @@ } static void destroy(void) { - destroyLock(); aglSetCurrentContext(NULL); aglDestroyContext(context); destroyWindow(); extgl_Close(); + destroyLock(); } static bool createContext(JNIEnv *env, jint bpp, jint alpha, jint depth, jint stencil) { |
|
From: Elias N. <eli...@us...> - 2003-10-06 14:01:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv6813 Modified Files: configure.in Log Message: Index: configure.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- configure.in 9 Sep 2003 08:10:38 -0000 1.44 +++ configure.in 6 Oct 2003 14:00:40 -0000 1.45 @@ -30,7 +30,7 @@ case "$host_os" in darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings" - LDFLAGS="-Xlinker -framework -Xlinker Carbon -Xlinker -framework -Xlinker JavaVM" + LDFLAGS="-Xlinker -framework -Xlinker Carbon -Xlinker -framework -Xlinker QuickTime -Xlinker -framework -Xlinker JavaVM" NATIVE_BUILD_DIR=macosx CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" |
|
From: Elias N. <eli...@us...> - 2003-10-06 14:00:56
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv6813/macosx Modified Files: Makefile.am Window.h org_lwjgl_input_Keyboard.cpp org_lwjgl_opengl_Window.cpp tools.cpp tools.h Log Message: Index: Makefile.am CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/Makefile.am =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 1 Oct 2003 09:33:22 -0000 1.7 +++ Makefile.am 6 Oct 2003 14:00:41 -0000 1.8 @@ -9,6 +9,7 @@ # org_lwjgl_input_Controller.cpp \ org_lwjgl_input_Keyboard.cpp \ org_lwjgl_opengl_MacOSX.cpp \ + tools.cpp \ # org_lwjgl_input_Mouse.cpp \ # org_lwjgl_input_Cursor.cpp \ org_lwjgl_opengl_Window.cpp Index: Window.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/Window.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Window.h 1 Oct 2003 09:33:22 -0000 1.1 +++ Window.h 6 Oct 2003 14:00:42 -0000 1.2 @@ -43,6 +43,8 @@ #define _LWJGL_WINDOW_H_INCLUDED_ #include <jni.h> + #include <Carbon/Carbon.h> extern void setQuitRequested(void); + extern bool registerKeyboardHandler(JNIEnv* env, WindowRef win_ref); #endif /* _LWJGL_WINDOW_H_INCLUDED_ */ Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_input_Keyboard.cpp 1 Oct 2003 09:33:22 -0000 1.7 +++ org_lwjgl_input_Keyboard.cpp 6 Oct 2003 14:00:43 -0000 1.8 @@ -39,10 +39,7 @@ * @version $Revision$ */ -#include <IOKit/IOKitLib.h> -#include <IOKit/hid/IOHIDKeys.h> -#include <CoreFoundation/CoreFoundation.h> -#include <stdlib.h> +#include "Window.h" #include "tools.h" #include "org_lwjgl_input_Keyboard.h" @@ -50,6 +47,55 @@ #define KEYBOARD_SIZE 256 #define KEY_EVENT_BACKLOG 40 +static pascal OSStatus doKeyDown(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + UInt32 key_code; + OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not get event key code\n"); +#endif + return eventNotHandledErr; + } +printf("key down, key %d\n", key_code); + return noErr; +} + +static pascal OSStatus doKeyUp(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + UInt32 key_code; + OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not get event key code\n"); +#endif + return eventNotHandledErr; + } +printf("key up, key %d\n", key_code); + return noErr; +} + +bool registerKeyboardHandler(JNIEnv* env, WindowRef win_ref) { + EventTypeSpec event_types[1]; + EventHandlerUPP handler_upp = NewEventHandlerUPP(doKeyUp); + event_types[0].eventClass = kEventClassKeyboard; + event_types[0].eventKind = kEventRawKeyUp; + OSStatus err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); + DisposeEventHandlerUPP(handler_upp); + if (noErr != err) { + throwException(env, "Could not register window event handler"); + return false; + } + handler_upp = NewEventHandlerUPP(doKeyDown); + event_types[0].eventClass = kEventClassKeyboard; + event_types[0].eventKind = kEventRawKeyDown; + err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); + DisposeEventHandlerUPP(handler_upp); + if (noErr != err) { + throwException(env, "Could not register window event handler"); + return false; + } + return true; +} + /* * Class: org_lwjgl_input_Keyboard * Method: initIDs @@ -60,36 +106,6 @@ { } -static void printCFString(CFStringRef str) { - CFIndex buffer_size = CFStringGetLength(str) + 1; - char * buffer = (char *)malloc(buffer_size); - if (buffer != NULL) { - if (CFStringGetCString(str, buffer, buffer_size, CFStringGetSystemEncoding())) - printf("%s", buffer); - free(buffer); - } -} - -static void printCFNumber(CFNumberRef num) { - long number; - - if (CFNumberGetValue(num, kCFNumberLongType, &number)) - printf("0x%lx (%ld)", number, number); -} - -static void printProperty(CFDictionaryRef dict, CFStringRef key) { - CFTypeRef val = CFDictionaryGetValue(dict, key); - if (val != NULL) { - CFTypeID type = CFGetTypeID(val); - if (type == CFArrayGetTypeID()) printf("array\n"); - else if (type == CFBooleanGetTypeID()) printf("boolean\n"); - else if (type == CFDictionaryGetTypeID()) printf("dictionary\n"); - else if (type == CFNumberGetTypeID()) printCFNumber((CFNumberRef)val); - else if (type == CFStringGetTypeID()) printCFString((CFStringRef)val); - else printf("<unknown object type>\n"); - } -} - /* * Class: org_lwjgl_input_Keyboard * Method: nCreate @@ -98,31 +114,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate (JNIEnv * env, jclass clazz) { - io_iterator_t device_iterator; - io_object_t hid_device; - kern_return_t kern_err; - CFMutableDictionaryRef dev_props; - CFMutableDictionaryRef matching_dic = IOServiceMatching(kIOHIDDeviceKey); - IOReturn err = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dic, &device_iterator); - if (err != kIOReturnSuccess) { - throwException(env, "Could not find matching devices"); - return; - } - while ((hid_device = IOIteratorNext(device_iterator)) != NULL) { - kern_err = IORegistryEntryCreateCFProperties(hid_device, &dev_props, kCFAllocatorDefault, kNilOptions); - IOObjectRelease(hid_device); - if (kern_err == KERN_SUCCESS && dev_props != NULL) { - printf("Device found: "); - printProperty(dev_props, CFSTR(kIOHIDProductKey)); - printf(" usage "); - printProperty(dev_props, CFSTR(kIOHIDPrimaryUsageKey)); - printf(" usage page "); - printProperty(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey)); - printf("\n"); - CFRelease(dev_props); - } - } - IOObjectRelease(device_iterator); } /* Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_opengl_Window.cpp 1 Oct 2003 09:33:22 -0000 1.11 +++ org_lwjgl_opengl_Window.cpp 6 Oct 2003 14:00:43 -0000 1.12 @@ -39,7 +39,8 @@ * @version $Revision$ */ -#include <Carbon/Carbon.h> +#include "Window.h" +#include <QuickTime/Movies.h> #include "org_lwjgl_opengl_Window.h" #include "extgl.h" #include "tools.h" @@ -47,6 +48,10 @@ static WindowRef win_ref; static AGLContext context; static bool close_requested; +static Ptr fullscreen_ptr; +static bool current_fullscreen; +static bool miniaturized; +static bool activated; static void setWindowTitle(JNIEnv *env, jstring title_obj) { const char* title = env->GetStringUTFChars(title_obj, NULL); @@ -63,7 +68,38 @@ } void setQuitRequested(void) { + lock(); close_requested = true; + unlock(); +} + +static pascal OSStatus doMiniaturized(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + lock(); + miniaturized = true; + unlock(); + return noErr; +} + +static pascal OSStatus doMaximize(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + lock(); + miniaturized = false; + unlock(); + return noErr; +} + +static pascal OSStatus doActivate(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + lock(); + miniaturized = false; + activated = true; + unlock(); + return noErr; +} + +static pascal OSStatus doDeactivate(EventHandlerCallRef next_handler, EventRef event, void *user_data) { + lock(); + activated = false; + unlock(); + return noErr; } static pascal OSStatus doQuit(EventHandlerCallRef next_handler, EventRef event, void *user_data) { @@ -71,24 +107,46 @@ return noErr; } -static void registerEventHandlers(JNIEnv *env) { - EventTypeSpec event_types[2]; +static bool registerWindowHandler(JNIEnv* env, EventHandlerProcPtr func, UInt32 event_kind) { + EventTypeSpec event_type; OSStatus err; - EventHandlerUPP handler_upp = NewEventHandlerUPP(doQuit); - event_types[0].eventClass = kEventClassWindow; - event_types[0].eventKind = kEventWindowClose; - err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); + EventHandlerUPP handler_upp = NewEventHandlerUPP(func); + event_type.eventClass = kEventClassWindow; + event_type.eventKind = event_kind; + err = InstallWindowEventHandler(win_ref, handler_upp, 1, &event_type, NULL, NULL); DisposeEventHandlerUPP(handler_upp); if (noErr != err) { throwException(env, "Could not register window event handler"); - return; + return true; } + return false; +} + +static bool registerEventHandlers(JNIEnv *env) { + bool error; + error = registerWindowHandler(env, doQuit, kEventWindowClose); + error = error || registerWindowHandler(env, doActivate, kEventWindowActivated); + error = error || registerWindowHandler(env, doDeactivate, kEventWindowDeactivated); + error = error || registerWindowHandler(env, doMiniaturized, kEventWindowCollapsed); + error = error || registerWindowHandler(env, doMaximize, kEventWindowExpanded); + if (error) + return false; + else + return registerKeyboardHandler(env, win_ref); +} + +static void destroyWindow(void) { + if (current_fullscreen) + EndFullScreen(fullscreen_ptr, 0); + else + DisposeWindow(win_ref); } static void destroy(void) { + destroyLock(); aglSetCurrentContext(NULL); aglDestroyContext(context); - DisposeWindow(win_ref); + destroyWindow(); extgl_Close(); } @@ -98,7 +156,6 @@ GLint attrib[] = {AGL_RGBA, AGL_DOUBLEBUFFER, AGL_ACCELERATED, - //AGL_FULLSCREEN, AGL_NO_RECOVERY, AGL_MINIMUM_POLICY, AGL_PIXEL_SIZE, bpp, @@ -131,8 +188,10 @@ } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsCloseRequested(JNIEnv *, jclass) { + lock(); const bool saved = close_requested; close_requested = false; + unlock(); return saved; } @@ -143,6 +202,9 @@ kWindowCollapseBoxAttribute| kWindowStandardHandlerAttribute; SetRect(&rect, x, y, x + width, y + height); + current_fullscreen = fullscreen == JNI_TRUE; + miniaturized = false; + activated = true; close_requested = false; if (!extgl_Open()) { throwException(env, "Could not load gl library"); @@ -152,17 +214,31 @@ throwException(env, "Could not load agl symbols"); return; } - status = CreateNewWindow(kDocumentWindowClass, window_attr, &rect, &win_ref); + if (current_fullscreen) + status = BeginFullScreen(&fullscreen_ptr, NULL, 0, 0, &win_ref, NULL, 0); + else + status = CreateNewWindow(kDocumentWindowClass, window_attr, &rect, &win_ref); if (noErr != status) { + extgl_Close(); throwException(env, "Could not create window"); return; } - registerEventHandlers(env); + if (!registerEventHandlers(env)) { + destroyWindow(); + extgl_Close(); + return; + } + if (!initLock(env)) { + destroyWindow(); + extgl_Close(); + return; + } setWindowTitle(env, title); - const RGBColor background_color = { 0, 0, 0 }; + const RGBColor background_color = {0, 0, 0}; SetWindowContentColor(win_ref, &background_color); if (!createContext(env, bpp, alpha, depth, stencil)) { - DisposeWindow(win_ref); + destroyLock(); + destroyWindow(); extgl_Close(); return; } @@ -175,19 +251,41 @@ SelectWindow(win_ref); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update - (JNIEnv *env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetTitle(JNIEnv * env, jclass clazz, jstring title_obj) { + setWindowTitle(env, title_obj); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update(JNIEnv *env, jclass clazz) { +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) { aglSwapBuffers(context); } +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize(JNIEnv *env, jclass clazz) { +} -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy - (JNIEnv *env, jclass clazz) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_restore(JNIEnv *env, jclass clazz) { +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy(JNIEnv *env, jclass clazz) { destroy(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsFocused(JNIEnv *env, jclass clazz) { + lock(); + bool result = activated; + unlock(); + return result; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty(JNIEnv *env, jclass clazz) { + return JNI_FALSE; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsMinimized(JNIEnv *env, jclass clazz) { + lock(); + bool result = miniaturized; + unlock(); + return result; } Index: tools.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/tools.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/tools.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tools.cpp 1 Oct 2003 09:02:52 -0000 1.1 +++ tools.cpp 6 Oct 2003 14:00:44 -0000 1.2 @@ -1,7 +1,45 @@ #include "tools.h" +#include <CoreServices/CoreServices.h> + +MPCriticalRegionID critical_region; void throwException(JNIEnv* env, const char* msg) { jclass cls = env->FindClass("java/lang/Exception"); - env->ThrowNew(cls, err); - env->DeleteLocalRef(cls); + env->ThrowNew(cls, msg); +} + +bool initLock(JNIEnv* env) { + OSStatus err = MPCreateCriticalRegion(&critical_region); + if (err != noErr) { + throwException(env, "Could not init lock"); + return false; + } + return true; +} + +void destroyLock(void) { + OSStatus err = MPDeleteCriticalRegion(critical_region); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not delete lock\n"); +#endif + } +} + +void lock(void) { + OSStatus err = MPEnterCriticalRegion(critical_region, kDurationForever); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not lock\n"); +#endif + } +} + +void unlock(void) { + OSStatus err = MPExitCriticalRegion(critical_region); + if (err != noErr) { +#ifdef _DEBUG + printf("Could not unlock\n"); +#endif + } } Index: tools.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/tools.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tools.h 1 Oct 2003 09:33:22 -0000 1.2 +++ tools.h 6 Oct 2003 14:00:44 -0000 1.3 @@ -4,5 +4,9 @@ #include <JavaVM/jni.h> extern void throwException(JNIEnv* env, const char* msg); +extern bool initLock(JNIEnv* env); +extern void destroyLock(void); +extern void lock(void); +extern void unlock(void); #endif |
|
From: Elias N. <eli...@us...> - 2003-10-06 08:34:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv21612/win32 Modified Files: org_lwjgl_opengl_Window.cpp Log Message: Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_opengl_Window.cpp 26 Sep 2003 16:26:10 -0000 1.8 +++ org_lwjgl_opengl_Window.cpp 6 Oct 2003 08:34:03 -0000 1.9 @@ -43,15 +43,13 @@ #include "Window.h" #include "org_lwjgl_opengl_Window.h" -bool oneShotInitialised = false; // Registers the LWJGL window class +static bool oneShotInitialised = false; // Registers the LWJGL window class HWND hwnd = NULL; // Handle to the window HDC hdc = NULL; // Device context HGLRC hglrc = NULL; // OpenGL context LPDIRECTINPUT lpdi = NULL; // DirectInput -bool isFullScreen = false; // Whether we're fullscreen or not -bool isMinimized = false; // Whether we're minimized or not -/*JNIEnv * environment = NULL; // Cached environment -jclass window; // Cached Java Window class*/ +static bool isFullScreen = false; // Whether we're fullscreen or not +static bool isMinimized = false; // Whether we're minimized or not extern HINSTANCE dll_handle; // Handle to the LWJGL dll RECT clientSize; @@ -613,8 +611,10 @@ * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty - (JNIEnv *env, jclass clazz) { - return dirty; + (JNIEnv *env, jclass clazz) { + bool result = dirty; + dirty = false; + return result; } /* |
|
From: Elias N. <eli...@us...> - 2003-10-06 08:13:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv18930/linux Modified Files: org_lwjgl_opengl_Window.cpp Log Message: Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_Window.cpp 26 Sep 2003 13:59:50 -0000 1.7 +++ org_lwjgl_opengl_Window.cpp 6 Oct 2003 08:13:18 -0000 1.8 @@ -542,7 +542,9 @@ */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty (JNIEnv *env, jclass clazz) { - return dirty; + bool result = dirty; + dirty = false; + return result; } /* |