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
(5) |
3
|
4
|
5
(1) |
6
|
7
|
|
8
|
9
(5) |
10
(2) |
11
(4) |
12
(21) |
13
(1) |
14
|
|
15
(2) |
16
|
17
|
18
|
19
|
20
(12) |
21
(6) |
|
22
|
23
(3) |
24
|
25
|
26
|
27
|
28
|
|
29
|
30
|
31
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2004-08-23 11:34:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17269/linux Modified Files: org_lwjgl_opengl_Display.cpp Log Message: Linux: Reimplemented undecorated flag through use of the obscure Motif window manager hint instead of the override_redirect flag Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_opengl_Display.cpp 23 Aug 2004 10:59:47 -0000 1.20 +++ org_lwjgl_opengl_Display.cpp 23 Aug 2004 11:33:57 -0000 1.21 @@ -56,6 +56,16 @@ #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 @@ -334,7 +344,7 @@ } static bool createWindow(JNIEnv* env, int width, int height) { -// bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); + bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); dirty = true; focused = true; minimized = false; @@ -368,6 +378,14 @@ } printfDebug("Created window\n"); current_win = win; + if (undecorated && current_window_mode == WINDOWED) { + // Use Motif decoration hint property and hope the window manager respects them + Atom motif_hints_atom = XInternAtom(getDisplay(), "_MOTIF_WM_HINTS", False); + MotifWmHints motif_hints; + motif_hints.flags = MWM_HINTS_DECORATIONS; + motif_hints.decorations = 0; + XChangeProperty (getDisplay(), getCurrentWindow(), motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); + } XSizeHints * size_hints = XAllocSizeHints(); size_hints->flags = PMinSize | PMaxSize; size_hints->min_width = width; |
|
From: Elias N. <eli...@us...> - 2004-08-23 10:59:58
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7348 Modified Files: org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Display.cpp Log Message: Linux: cleanup and remove input grab in button press Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- org_lwjgl_input_Mouse.cpp 23 Aug 2004 08:46:35 -0000 1.61 +++ org_lwjgl_input_Mouse.cpp 23 Aug 2004 10:59:47 -0000 1.62 @@ -124,10 +124,11 @@ static void updateCursor(void) { Cursor cursor; - if (shouldGrab()) + if (shouldGrab()) { cursor = blank_cursor; - else + } else { cursor = current_cursor; + } XDefineCursor(getDisplay(), getCurrentWindow(), cursor); } @@ -143,7 +144,6 @@ if (isLegacyFullscreen()) { XWindowAttributes win_attribs; XGetWindowAttributes(getDisplay(), getCurrentWindow(), &win_attribs); -// XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), 0, 0); XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), win_attribs.x, win_attribs.y); } XFlush(getDisplay()); Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_opengl_Display.cpp 23 Aug 2004 08:46:35 -0000 1.19 +++ org_lwjgl_opengl_Display.cpp 23 Aug 2004 10:59:47 -0000 1.20 @@ -218,11 +218,6 @@ if (new_grab != grab) { grab = new_grab; updateInputGrab(); -/* // Attempt to regain focus - if (grab) { - XMapRaised(getDisplay(), getCurrentWindow()); - waitMapped(getCurrentWindow()); - }*/ } } @@ -278,7 +273,6 @@ dirty = true; break; case ButtonPress: - checkInput(); handleButtonPress(&(event.xbutton)); break; case ButtonRelease: |
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1750/src/native/linux Modified Files: Window.h display.cpp display.h org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Display.cpp Log Message: Linux: Implemented support for Extended Window Manager Hints. LWJGL now cooperates much better with the window manager, if the X randr and EWMH extensions are supported. Especially fullscreen handling has improved, by avoiding the use of the override_redirect flag. Index: display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- display.cpp 21 Aug 2004 20:31:24 -0000 1.5 +++ display.cpp 23 Aug 2004 08:46:35 -0000 1.6 @@ -51,27 +51,32 @@ #include "common_tools.h" #include "Window.h" -typedef enum {XRANDR, XF86VIDMODE, NONE} extension; - typedef struct { int width; int height; int freq; union { - int size_index; - XF86VidModeModeInfo xf86vm_modeinfo; + int size_index; // Data for Xrandr extension + XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension } mode_data; } mode_info; static int saved_width; static int saved_height; static int saved_freq; -static int gamma_ramp_length = 0; +static int current_width; +static int current_height; +static int current_freq; +static int saved_gamma_ramp_length = 0; static unsigned short *r_ramp; static unsigned short *g_ramp; static unsigned short *b_ramp; static extension current_extension = NONE; +extension getCurrentDisplayModeExtension(void) { + return current_extension; +} + static bool getXF86VidModeVersion(Display *disp, int *major, int *minor) { int event_base, error_base; @@ -253,7 +258,7 @@ r_ramp = NULL; g_ramp = NULL; b_ramp = NULL; - gamma_ramp_length = 0; + saved_gamma_ramp_length = 0; } static int getGammaRampLength(Display *disp, int screen) { @@ -269,16 +274,24 @@ return ramp_size; } -jobject initDisplay(JNIEnv *env) { +int getGammaRampLength(int screen) { + Display *disp = XOpenDisplay(NULL); + if (disp == NULL) { + printfDebug("Could not open display"); + return 0; + } + return getGammaRampLength(disp, screen); + XCloseDisplay(disp); +} + +jobject initDisplay(JNIEnv *env, int screen) { int num_modes; mode_info *avail_modes; - int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { throwException(env, "Could not open display"); return NULL; } - screen = DefaultScreen(disp); current_extension = getBestDisplayModeExtension(disp); if (current_extension == NONE) { @@ -292,9 +305,9 @@ XCloseDisplay(disp); return NULL; } - saved_width = avail_modes[0].width; - saved_height = avail_modes[0].height; - saved_freq = avail_modes[0].freq; + saved_width = current_width = avail_modes[0].width; + saved_height = current_height = avail_modes[0].height; + saved_freq = current_freq = avail_modes[0].freq; int bpp = XDefaultDepth(disp, screen); printfDebug("Original display dimensions: width %d, height %d freq %d\n", saved_width, saved_height, saved_freq); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/opengl/DisplayMode"); @@ -304,19 +317,43 @@ free(avail_modes); /* Fetch the current gamma ramp */ - gamma_ramp_length = getGammaRampLength(disp, screen); - if (gamma_ramp_length > 0) { - r_ramp = (unsigned short *)malloc(sizeof(unsigned short)*gamma_ramp_length); - g_ramp = (unsigned short *)malloc(sizeof(unsigned short)*gamma_ramp_length); - b_ramp = (unsigned short *)malloc(sizeof(unsigned short)*gamma_ramp_length); - if (!XF86VidModeGetGammaRamp(disp, screen, gamma_ramp_length, r_ramp, g_ramp, b_ramp)) + saved_gamma_ramp_length = getGammaRampLength(disp, screen); + if (saved_gamma_ramp_length > 0) { + r_ramp = (unsigned short *)malloc(sizeof(unsigned short)*saved_gamma_ramp_length); + g_ramp = (unsigned short *)malloc(sizeof(unsigned short)*saved_gamma_ramp_length); + b_ramp = (unsigned short *)malloc(sizeof(unsigned short)*saved_gamma_ramp_length); + if (!XF86VidModeGetGammaRamp(disp, screen, saved_gamma_ramp_length, r_ramp, g_ramp, b_ramp)) freeSavedGammaRamps(); } XCloseDisplay(disp); return newMode; } -void switchDisplayMode(JNIEnv * env, jobject mode) { +void temporaryRestoreMode(int screen) { + Display *disp = XOpenDisplay(NULL); + if (disp == NULL) { + printfDebug("Could not open display"); + return; + } + if (!setMode(disp, screen, current_width, current_height, current_freq)) + printfDebug("Could not restore mode\n"); + XCloseDisplay(disp); + // Don't propagate error to caller +} + +void temporaryResetMode(int screen) { + Display *disp = XOpenDisplay(NULL); + if (disp == NULL) { + printfDebug("Could not open display"); + return; + } + if (!setMode(disp, screen, saved_width, saved_height, saved_freq)) + printfDebug("Could not reset mode\n"); + XCloseDisplay(disp); + // Don't propagate error to caller +} + +void switchDisplayMode(JNIEnv * env, jobject mode, int screen) { if (mode == NULL) { throwException(env, "mode must be non-null"); return; @@ -328,39 +365,38 @@ int width = env->GetIntField(mode, fid_width); int height = env->GetIntField(mode, fid_height); int freq = env->GetIntField(mode, fid_freq); - int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { throwException(env, "Could not open display"); return; } - screen = DefaultScreen(disp); - if (!setMode(disp, screen, width, height, freq)) + if (setMode(disp, screen, width, height, freq)) { + current_width = width; + current_height = height; + current_freq = freq; + } else throwException(env, "Could not switch mode."); XCloseDisplay(disp); } -void resetDisplayMode(JNIEnv *env) { - int screen; +void resetDisplayMode(JNIEnv *env, int screen) { Display *disp = XOpenDisplay(NULL); // Display *disp = incDisplay(env); if (disp == NULL) return; - screen = DefaultScreen(disp); if (!setMode(disp, screen, saved_width, saved_height, saved_freq)) { printfDebug("Failed to reset mode"); } - if (gamma_ramp_length > 0) { - XF86VidModeSetGammaRamp(disp, screen, gamma_ramp_length, r_ramp, g_ramp, b_ramp); + if (saved_gamma_ramp_length > 0) { + XF86VidModeSetGammaRamp(disp, screen, saved_gamma_ramp_length, r_ramp, g_ramp, b_ramp); freeSavedGammaRamps(); } // decDisplay(); XCloseDisplay(disp); } -jobjectArray getAvailableDisplayModes(JNIEnv * env) { +jobjectArray getAvailableDisplayModes(JNIEnv * env, int screen) { int num_modes, i; - int screen; mode_info *avail_modes; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { @@ -368,7 +404,6 @@ return NULL; } - screen = DefaultScreen(disp); int bpp = XDefaultDepth(disp, screen); avail_modes = getDisplayModes(disp, screen, &num_modes); if (avail_modes == NULL) { @@ -390,21 +425,17 @@ return ret; } -int getGammaRampLength(void) { - return gamma_ramp_length; -} - -void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer) { - if (gamma_ramp_length == 0) { - throwException(env, "gamma ramp length == 0."); - return; - } +void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer, int screen) { Display * disp = XOpenDisplay(NULL); if (disp == NULL) { throwException(env, "Could not open display"); return; } - int screen = DefaultScreen(disp); + int gamma_ramp_length = getGammaRampLength(disp, screen); + if (gamma_ramp_length == 0) { + throwException(env, "Gamma ramp not supported"); + return; + } const float *gamma_ramp = (const float *)env->GetDirectBufferAddress(gamma_ramp_buffer); unsigned short *ramp; ramp = (unsigned short *)malloc(sizeof(unsigned short)*gamma_ramp_length); Index: display.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- display.h 3 Jul 2004 14:53:25 -0000 1.2 +++ display.h 23 Aug 2004 08:46:35 -0000 1.3 @@ -44,11 +44,16 @@ #include <jni.h> -extern jobject initDisplay(JNIEnv *env); -extern void switchDisplayMode(JNIEnv * env, jobject mode); -extern void resetDisplayMode(JNIEnv * env); -extern jobjectArray getAvailableDisplayModes(JNIEnv * env); -extern int getGammaRampLength(void); -extern void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer); +typedef enum {XRANDR, XF86VIDMODE, NONE} extension; + +extern jobject initDisplay(JNIEnv *env, int screen); +extern void switchDisplayMode(JNIEnv * env, jobject mode, int screen); +extern void resetDisplayMode(JNIEnv * env, int screen); +extern jobjectArray getAvailableDisplayModes(JNIEnv * env, int screen); +extern int getGammaRampLength(int screen); +extern void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer, int screen); +extern extension getCurrentDisplayModeExtension(); +extern void temporaryResetMode(int screen); +extern void temporaryRestoreMode(int screen); #endif Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_opengl_Display.cpp 21 Aug 2004 10:22:23 -0000 1.18 +++ org_lwjgl_opengl_Display.cpp 23 Aug 2004 08:46:35 -0000 1.19 @@ -56,6 +56,8 @@ #define USEGLX13 extgl_Extensions.GLX13 #define ERR_MSG_SIZE 1024 +typedef enum {FULLSCREEN_LEGACY, FULLSCREEN_NETWM, WINDOWED} window_mode; + static GLXContext context = NULL; // OpenGL rendering context static GLXFBConfig *configs = NULL; static GLXWindow glx_window; @@ -64,7 +66,7 @@ static Atom delete_atom; static Colormap cmap; static Window current_win; -static bool current_fullscreen; +static window_mode current_window_mode; static int current_height; static int current_width; @@ -158,7 +160,6 @@ static void waitMapped(Window win) { XEvent event; - do { XMaskEvent(getDisplay(), StructureNotifyMask, &event); } while ((event.type != MapNotify) || (event.xmap.event != win)); @@ -182,27 +183,31 @@ } bool releaseInput(void) { - if (current_fullscreen || input_released) + if (isLegacyFullscreen() || input_released) return false; input_released = true; setRepeatMode(AutoRepeatModeDefault); updateInputGrab(); -/* if (current_fullscreen) { + if (current_window_mode == FULLSCREEN_NETWM) { XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); - }*/ + temporaryResetMode(getCurrentScreen()); + } return true; } static void acquireInput(void) { - if (current_fullscreen || !input_released) + if (isLegacyFullscreen() || !input_released) return; input_released = false; setRepeatMode(AutoRepeatModeOff); updateInputGrab(); + if (current_window_mode == FULLSCREEN_NETWM) { + temporaryRestoreMode(getCurrentScreen()); + } } -bool isFullscreen(void) { - return current_fullscreen; +bool isLegacyFullscreen(void) { + return current_window_mode == FULLSCREEN_LEGACY; } bool shouldGrab(void) { @@ -210,8 +215,15 @@ } void setGrab(bool new_grab) { - grab = new_grab; - updateInputGrab(); + if (new_grab != grab) { + grab = new_grab; + updateInputGrab(); +/* // Attempt to regain focus + if (grab) { + XMapRaised(getDisplay(), getCurrentWindow()); + waitMapped(getCurrentWindow()); + }*/ + } } static void handleMotion(XMotionEvent *event) { @@ -303,8 +315,32 @@ 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, (unsigned char **)&supported_list); + if (result != Success) { + printfDebug("Anable to query _NET_SUPPORTED window property\n"); + return false; + } + Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False); + bool supported = false; + for (unsigned long i = 0; i < nitems; i++) { + if (fullscreen_atom == supported_list[i]) { + supported = true; + break; + } + } + XFree(supported_list); + return supported; +} + static bool createWindow(JNIEnv* env, int width, int height) { - bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); +// bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); dirty = true; focused = true; minimized = false; @@ -320,7 +356,6 @@ 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; @@ -328,7 +363,7 @@ attribs.background_pixel = 0xFF000000; attribs.win_gravity = NorthWestGravity; attribmask = CWColormap | CWBackPixel | CWEventMask | CWWinGravity; - if (current_fullscreen || undecorated) { + if (isLegacyFullscreen()/* || undecorated*/) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } @@ -349,11 +384,11 @@ XFree(size_hints); delete_atom = XInternAtom(getDisplay(), "WM_DELETE_WINDOW", False); XSetWMProtocols(getDisplay(), win, &delete_atom, 1); -/* if (current_fullscreen) { + 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); @@ -609,27 +644,27 @@ } JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Display_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz) { - return getAvailableDisplayModes(env); + return getAvailableDisplayModes(env, getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jobject mode) { - switchDisplayMode(env, mode); + switchDisplayMode(env, mode, getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_resetDisplayMode(JNIEnv *env, jclass clazz) { - resetDisplayMode(env); + resetDisplayMode(env, getCurrentScreen()); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { - return (jint)getGammaRampLength(); + return (jint)getGammaRampLength(getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_setGammaRamp(JNIEnv *env, jclass clazz, jobject gamma_buffer) { - setGammaRamp(env, gamma_buffer); + setGammaRamp(env, gamma_buffer, getCurrentScreen()); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Display_init(JNIEnv *env, jclass clazz) { - return initDisplay(env); + return initDisplay(env, getCurrentScreen()); } JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Display_getAdapter(JNIEnv *env , jclass clazz) { @@ -665,7 +700,14 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, jclass clazz, jobject mode, jboolean fullscreen) { - current_fullscreen = fullscreen == JNI_TRUE; + 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(mode); jfieldID fid_width = env->GetFieldID(cls_displayMode, "width", "I"); jfieldID fid_height = env->GetFieldID(cls_displayMode, "height", "I"); @@ -689,11 +731,6 @@ destroyWindow(); } -/* - * Class: org_lwjgl_opengl_GLWindow - * Method: swapBuffers - * Signature: ()V - */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_swapBuffers(JNIEnv * env, jclass clazz) { dirty = false; @@ -703,12 +740,6 @@ glXSwapBuffers(getDisplay(), getCurrentWindow()); } - -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsDirty - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsDirty (JNIEnv *env, jclass clazz) { bool result = dirty; @@ -716,21 +747,11 @@ return result ? JNI_TRUE : JNI_FALSE; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsVisible - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsVisible (JNIEnv *env, jclass clazz) { return minimized ? JNI_FALSE : JNI_TRUE; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsCloseRequested - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsCloseRequested (JNIEnv *, jclass) { bool saved = closerequested; @@ -738,11 +759,6 @@ return saved; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsActive - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsActive (JNIEnv *env, jclass clazz) { return focused ? JNI_TRUE : JNI_FALSE; Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Window.h 24 Jul 2004 21:19:08 -0000 1.18 +++ Window.h 23 Aug 2004 08:46:35 -0000 1.19 @@ -124,7 +124,7 @@ /* * Return true if we are in fullscreen mode */ - extern bool isFullscreen(void); + extern bool isLegacyFullscreen(void); /* * convert bit-per-pixel to bits-per-element Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- org_lwjgl_input_Mouse.cpp 21 Aug 2004 00:18:19 -0000 1.60 +++ org_lwjgl_input_Mouse.cpp 23 Aug 2004 08:46:35 -0000 1.61 @@ -140,7 +140,7 @@ if (result == GrabSuccess) { pointer_grabbed = true; // make sure we have a centered window - if (isFullscreen()) { + if (isLegacyFullscreen()) { XWindowAttributes win_attribs; XGetWindowAttributes(getDisplay(), getCurrentWindow(), &win_attribs); // XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), 0, 0); @@ -162,7 +162,7 @@ void updatePointerGrab(void) { if (!created) return; - if (isFullscreen() || shouldGrab()) { + if (isLegacyFullscreen() || shouldGrab()) { grabPointer(); } else { ungrabPointer(); Index: org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- org_lwjgl_input_Keyboard.cpp 21 Aug 2004 10:22:23 -0000 1.36 +++ org_lwjgl_input_Keyboard.cpp 23 Aug 2004 08:46:35 -0000 1.37 @@ -80,7 +80,7 @@ void updateKeyboardGrab(void) { if (!created) return; - if (isFullscreen()/* || shouldGrab()*/) { + if (isLegacyFullscreen()/* || shouldGrab()*/) { grabKeyboard(); } else { ungrabKeyboard(); |
|
From: Elias N. <eli...@us...> - 2004-08-21 20:31:47
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28998 Modified Files: configure.in Log Message: Linux: Added support for X RandR extension Index: configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- configure.in 21 Aug 2004 00:18:20 -0000 1.54 +++ configure.in 21 Aug 2004 20:31:24 -0000 1.55 @@ -19,16 +19,16 @@ AC_CANONICAL_HOST case "$host_os" in - darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings" - LDFLAGS="-Xlinker -framework -Xlinker JavaVM -Xlinker -framework -Xlinker ApplicationServices -Xlinker -framework -Xlinker CoreServices -Xlinker -framework -Xlinker Carbon" - NATIVE_BUILD_DIR=macosx - CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" - CFLAGS="$CFLAGS -Wall $_BUILD_FLAGS" - ;; + darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings" + LDFLAGS="-Xlinker -framework -Xlinker JavaVM -Xlinker -framework -Xlinker ApplicationServices -Xlinker -framework -Xlinker CoreServices -Xlinker -framework -Xlinker Carbon" + NATIVE_BUILD_DIR=macosx + CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" + CFLAGS="$CFLAGS -Wall $_BUILD_FLAGS" + ;; bsdi* | linux* | solaris*) AC_PATH_XTRA AC_LIBTOOL_DLOPEN _BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS" - LDFLAGS="-Wl,-static,-lXcursor,-lXrender,-call_shared" + LDFLAGS="-Wl,-static,-lXcursor,-lXrender,-lXrandr,-call_shared" AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) NATIVE_BUILD_DIR=linux CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" |
|
From: Elias N. <eli...@us...> - 2004-08-21 20:31:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28998/linux Modified Files: display.cpp Log Message: Linux: Added support for X RandR extension Index: display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- display.cpp 21 Aug 2004 17:42:23 -0000 1.4 +++ display.cpp 21 Aug 2004 20:31:24 -0000 1.5 @@ -42,6 +42,7 @@ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/extensions/xf86vmode.h> +#include <X11/extensions/Xrandr.h> #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> @@ -50,14 +51,28 @@ #include "common_tools.h" #include "Window.h" +typedef enum {XRANDR, XF86VIDMODE, NONE} extension; + +typedef struct { + int width; + int height; + int freq; + union { + int size_index; + XF86VidModeModeInfo xf86vm_modeinfo; + } mode_data; +} mode_info; + static int saved_width; static int saved_height; +static int saved_freq; static int gamma_ramp_length = 0; static unsigned short *r_ramp; static unsigned short *g_ramp; static unsigned short *b_ramp; +static extension current_extension = NONE; -static bool getVidModeExtensionVersion(Display *disp, int screen, int *major, int *minor) { +static bool getXF86VidModeVersion(Display *disp, int *major, int *minor) { int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { @@ -65,45 +80,170 @@ return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { - printfDebug("Could not determine XF86VidMode version\n"); + printfDebug("Could not query XF86VidMode version\n"); return false; } printfDebug("XF86VidMode extension version %i.%i\n", *major, *minor); return true; } -static bool getDisplayModes(Display *disp, int screen, int *num_modes, XF86VidModeModeInfo ***avail_modes) { +static bool getXrandrVersion(Display *disp, int *major, int *minor) { + int event_base, error_base; + + if (!XRRQueryExtension(disp, &event_base, &error_base)) { + printfDebug("Xrandr extension not available\n"); + return false; + } + if (!XRRQueryVersion(disp, major, minor)) { + printfDebug("Could not query Xrandr version\n"); + return false; + } + printfDebug("Xrandr extension version %i.%i\n", *major, *minor); + return true; +} + +static bool isXrandrSupported(Display *disp) { + int major, minor; + if (!getXrandrVersion(disp, &major, &minor)) + return false; + return major >= 1; +} + +static bool isXF86VidModeSupported(Display *disp) { int minor_ver, major_ver; - if (!getVidModeExtensionVersion(disp, screen, &major_ver, &minor_ver)) + if (!getXF86VidModeVersion(disp, &major_ver, &minor_ver)) return false; - XF86VidModeGetAllModeLines(disp, screen, num_modes, avail_modes); + return major_ver >= 2; +} + +static extension getBestDisplayModeExtension(Display *disp) { + if (isXrandrSupported(disp)) + return XRANDR; + else if (isXF86VidModeSupported(disp)) + return XF86VIDMODE; + else + return NONE; +} + +static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) { + int num_randr_sizes; + XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes); + /* Count number of modes */ + int num_randr_modes = 0; + for (int i = 0; i < num_randr_sizes; i++) { + int num_randr_rates; + XRRRates(disp, screen, i, &num_randr_rates); + num_randr_modes += num_randr_rates; + } + mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_randr_modes); + if (avail_modes == NULL) + return NULL; + int mode = 0; + for (int i = 0; i < num_randr_sizes; i++) { + int num_randr_rates; + short *freqs = XRRRates(disp, screen, i, &num_randr_rates); + for (int j = 0; j < num_randr_rates; j++) { + avail_modes[mode].width = sizes[i].width; + avail_modes[mode].height = sizes[i].height; + avail_modes[mode].freq = freqs[j]; + avail_modes[mode].mode_data.size_index = i; + mode++; + } + } + *num_modes = num_randr_modes; + return avail_modes; +} + +static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) { + int num_xf86vm_modes; + XF86VidModeModeInfo **avail_xf86vm_modes; + XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes); + mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes); + if (avail_modes == NULL) { + XFree(avail_xf86vm_modes); + return NULL; + } + for (int i = 0; i < num_xf86vm_modes; i++) { + avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay; + avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay; + avail_modes[i].freq = 0; // No frequency support in XF86VidMode + avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i]; + } + XFree(avail_xf86vm_modes); + *num_modes = num_xf86vm_modes; + return avail_modes; +} + +static mode_info *getDisplayModes(Display *disp, int screen, int *num_modes) { + switch (current_extension) { + case XF86VIDMODE: + return getXF86VidModeDisplayModes(disp, screen, num_modes); + case XRANDR: + return getXrandrDisplayModes(disp, screen, num_modes); + case NONE: + // fall through + default: + // Should never happen + return NULL; + } +} + +static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) { + return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo); +} + +static bool setXrandrMode(Display *disp, int screen, mode_info *mode) { + Status success; + do { + Time config_time; + Drawable root_window = RootWindow(disp, screen); + XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo (disp, root_window); + XRRConfigTimes(screen_configuration, &config_time); + Rotation current_rotation; + XRRConfigRotations(screen_configuration, ¤t_rotation); + success = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, config_time); + XRRFreeScreenConfigInfo(screen_configuration); + } while (success != 0); return true; } -static bool setMode(Display *disp, int screen, int width, int height, bool lock_mode) { +static bool setMode(Display *disp, int screen, int width, int height, int freq/*, bool lock_mode*/) { + if (current_extension == NONE) + return false; int num_modes, i; - XF86VidModeModeInfo **avail_modes; - if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { + mode_info *avail_modes = getDisplayModes(disp, screen, &num_modes); + if (avail_modes == NULL) { printfDebug("Could not get display modes\n"); return false; } - XF86VidModeLockModeSwitch(disp, screen, 0); + bool result = false; for ( i = 0; i < num_modes; ++i ) { - printfDebug("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); - if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { - if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { - printfDebug("Could not switch mode\n"); - break; + printfDebug("Mode %d: %dx%d @%d\n", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); + if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { + switch (current_extension) { + case XF86VIDMODE: + if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { + printfDebug("Could not switch mode\n"); + continue; + } + break; + case XRANDR: + if (!setXrandrMode(disp, screen, &avail_modes[i])) { + printfDebug("Could not switch mode\n"); + continue; + } + break; + case NONE: // Should never happen + default: // Should never happen + continue; } - if (lock_mode) - XF86VidModeLockModeSwitch(disp, screen, 1); - XFree(avail_modes); - return true; + result = true; + break; } } - XFree(avail_modes); + free(avail_modes); XFlush(disp); - return false; + return result; } static void freeSavedGammaRamps() { @@ -117,8 +257,8 @@ } static int getGammaRampLength(Display *disp, int screen) { - int minor_ver, major_ver, ramp_size; - if (!getVidModeExtensionVersion(disp, screen, &major_ver, &minor_ver) || major_ver < 2) { + int ramp_size; + if (!isXF86VidModeSupported(disp)) { printfDebug("XF86VidMode extension version >= 2 not found\n"); return 0; } @@ -131,7 +271,7 @@ jobject initDisplay(JNIEnv *env) { int num_modes; - XF86VidModeModeInfo **avail_modes; + mode_info *avail_modes; int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { @@ -140,19 +280,28 @@ } screen = DefaultScreen(disp); - if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { + current_extension = getBestDisplayModeExtension(disp); + if (current_extension == NONE) { + throwException(env, "No display mode extension is available"); + XCloseDisplay(disp); + return NULL; + } + avail_modes = getDisplayModes(disp, screen, &num_modes); + if (avail_modes == NULL) { throwException(env, "Could not get display modes"); + XCloseDisplay(disp); return NULL; } - saved_width = avail_modes[0]->hdisplay; - saved_height = avail_modes[0]->vdisplay; + saved_width = avail_modes[0].width; + saved_height = avail_modes[0].height; + saved_freq = avail_modes[0].freq; int bpp = XDefaultDepth(disp, screen); - printfDebug("Original display dimensions: width %d, height %d\n", saved_width, saved_height); + printfDebug("Original display dimensions: width %d, height %d freq %d\n", saved_width, saved_height, saved_freq); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/opengl/DisplayMode"); jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); - jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, 0); + jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, saved_freq); - XFree(avail_modes); + free(avail_modes); /* Fetch the current gamma ramp */ gamma_ramp_length = getGammaRampLength(disp, screen); @@ -175,8 +324,10 @@ jclass cls_displayMode = env->GetObjectClass(mode); jfieldID fid_width = env->GetFieldID(cls_displayMode, "width", "I"); jfieldID fid_height = env->GetFieldID(cls_displayMode, "height", "I"); + jfieldID fid_freq = env->GetFieldID(cls_displayMode, "freq", "I"); int width = env->GetIntField(mode, fid_width); int height = env->GetIntField(mode, fid_height); + int freq = env->GetIntField(mode, fid_freq); int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { @@ -184,7 +335,7 @@ return; } screen = DefaultScreen(disp); - if (!setMode(disp, screen, width, height, true)) + if (!setMode(disp, screen, width, height, freq)) throwException(env, "Could not switch mode."); XCloseDisplay(disp); } @@ -196,7 +347,7 @@ if (disp == NULL) return; screen = DefaultScreen(disp); - if (!setMode(disp, screen, saved_width, saved_height, false)) { + if (!setMode(disp, screen, saved_width, saved_height, saved_freq)) { printfDebug("Failed to reset mode"); } if (gamma_ramp_length > 0) { @@ -210,7 +361,7 @@ jobjectArray getAvailableDisplayModes(JNIEnv * env) { int num_modes, i; int screen; - XF86VidModeModeInfo **avail_modes; + mode_info *avail_modes; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { throwException(env, "Could not open display"); @@ -219,8 +370,8 @@ screen = DefaultScreen(disp); int bpp = XDefaultDepth(disp, screen); - - if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { + avail_modes = getDisplayModes(disp, screen, &num_modes); + if (avail_modes == NULL) { printfDebug("Could not get display modes\n"); XCloseDisplay(disp); return NULL; @@ -231,10 +382,10 @@ jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V"); for (i = 0; i < num_modes; i++) { - jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0); + jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq); env->SetObjectArrayElement(ret, i, displayMode); } - XFree(avail_modes); + free(avail_modes); XCloseDisplay(disp); return ret; } |
|
From: Elias N. <eli...@us...> - 2004-08-21 17:42:40
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9617 Modified Files: display.cpp Log Message: Linux: Added missing throwException in display.cpp.initDisplay() Index: display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- display.cpp 22 Jul 2004 08:52:25 -0000 1.3 +++ display.cpp 21 Aug 2004 17:42:23 -0000 1.4 @@ -130,8 +130,8 @@ } jobject initDisplay(JNIEnv *env) { - int num_modes; - XF86VidModeModeInfo **avail_modes; + int num_modes; + XF86VidModeModeInfo **avail_modes; int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { @@ -141,7 +141,8 @@ screen = DefaultScreen(disp); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug("Could not get display modes\n"); + throwException(env, "Could not get display modes"); + return NULL; } saved_width = avail_modes[0]->hdisplay; saved_height = avail_modes[0]->vdisplay; |
|
From: Elias N. <eli...@us...> - 2004-08-21 10:22:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9259/linux Modified Files: org_lwjgl_input_Keyboard.cpp org_lwjgl_opengl_Display.cpp Log Message: Linux: only grab the keyboard when in fullscreen mode. Remove the alt-tab hack Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_opengl_Display.cpp 12 Aug 2004 15:22:47 -0000 1.17 +++ org_lwjgl_opengl_Display.cpp 21 Aug 2004 10:22:23 -0000 1.18 @@ -187,6 +187,9 @@ input_released = true; setRepeatMode(AutoRepeatModeDefault); updateInputGrab(); +/* if (current_fullscreen) { + XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); + }*/ return true; } @@ -323,7 +326,8 @@ attribs.colormap = cmap; attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; attribs.background_pixel = 0xFF000000; - attribmask = CWColormap | CWBackPixel | CWEventMask; + attribs.win_gravity = NorthWestGravity; + attribmask = CWColormap | CWBackPixel | CWEventMask | CWWinGravity; if (current_fullscreen || undecorated) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; @@ -345,6 +349,11 @@ XFree(size_hints); delete_atom = XInternAtom(getDisplay(), "WM_DELETE_WINDOW", False); XSetWMProtocols(getDisplay(), win, &delete_atom, 1); +/* if (current_fullscreen) { + 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); @@ -368,11 +377,6 @@ return current_height; } -/* - * Class: org_lwjgl_Window - * Method: nUpdate - * Signature: ()V - */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nUpdate (JNIEnv *env, jclass clazz) { Index: org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- org_lwjgl_input_Keyboard.cpp 12 Jun 2004 20:28:32 -0000 1.35 +++ org_lwjgl_input_Keyboard.cpp 21 Aug 2004 10:22:23 -0000 1.36 @@ -80,18 +80,13 @@ void updateKeyboardGrab(void) { if (!created) return; - if (isFullscreen() || shouldGrab()) { + if (isFullscreen()/* || shouldGrab()*/) { grabKeyboard(); } else { ungrabKeyboard(); } } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nCreate - * Signature: ()Z - */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate (JNIEnv * env, jclass clazz) { @@ -128,11 +123,6 @@ updateKeyboardGrab(); } -/* - * Class: org_lwjgl_input_Keyboard - * Method: nDestroy - * Signature: ()V - */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy (JNIEnv * env, jclass clazz) { @@ -199,17 +189,6 @@ unsigned char keycode = getKeycode(event); unsigned char state = eventState(event); key_buf[keycode] = state; - if (key_buf[org_lwjgl_input_Keyboard_KEY_LMENU] == 1 || - key_buf[org_lwjgl_input_Keyboard_KEY_RMENU] == 1) { - if (key_buf[org_lwjgl_input_Keyboard_KEY_TAB] == 1) { - if (releaseInput()) { - key_buf[org_lwjgl_input_Keyboard_KEY_RMENU] = 0; - key_buf[org_lwjgl_input_Keyboard_KEY_LMENU] = 0; - key_buf[org_lwjgl_input_Keyboard_KEY_TAB] = 0; - return; - } - } - } if (buffer_enabled) bufferEvent(event); } |
|
From: Elias N. <eli...@us...> - 2004-08-21 00:18:31
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5586 Modified Files: configure.in Log Message: Made Xcursor library static linked instead of dynamically loaded Index: configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- configure.in 21 Jul 2004 09:25:53 -0000 1.53 +++ configure.in 21 Aug 2004 00:18:20 -0000 1.54 @@ -28,8 +28,9 @@ bsdi* | linux* | solaris*) AC_PATH_XTRA AC_LIBTOOL_DLOPEN _BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS" + LDFLAGS="-Wl,-static,-lXcursor,-lXrender,-call_shared" AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) - NATIVE_BUILD_DIR=linux + NATIVE_BUILD_DIR=linux CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" CFLAGS="$CFLAGS -Wall $_BUILD_FLAGS" LIBS="$LIBS $X_LIBS" |
|
From: Elias N. <eli...@us...> - 2004-08-21 00:18:31
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5586/linux Modified Files: Makefile.am org_lwjgl_input_Mouse.cpp org_lwjgl_input_Cursor.cpp Removed Files: extxcursor.h extxcursor.cpp Log Message: Made Xcursor library static linked instead of dynamically loaded Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- org_lwjgl_input_Mouse.cpp 30 Jul 2004 13:30:15 -0000 1.59 +++ org_lwjgl_input_Mouse.cpp 21 Aug 2004 00:18:19 -0000 1.60 @@ -48,7 +48,8 @@ #include "Window.h" #include "common_tools.h" #include "org_lwjgl_input_Mouse.h" -#include "extxcursor.h" +#include <X11/Xcursor/Xcursor.h> +//#include "extxcursor.h" #define NUM_BUTTONS 3 @@ -139,8 +140,12 @@ if (result == GrabSuccess) { pointer_grabbed = true; // make sure we have a centered window - if (isFullscreen()) - XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), 0, 0); + if (isFullscreen()) { + XWindowAttributes win_attribs; + XGetWindowAttributes(getDisplay(), getCurrentWindow(), &win_attribs); +// XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), 0, 0); + XF86VidModeSetViewPort(getDisplay(), getCurrentScreen(), win_attribs.x, win_attribs.y); + } XFlush(getDisplay()); } } @@ -191,8 +196,8 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps (JNIEnv *env, jclass clazz) { int caps = 0; - if (!isXcursorLoaded()) - return caps; +/* if (!isXcursorLoaded()) + return caps;*/ XcursorBool argb_supported = XcursorSupportsARGB(getDisplay()); XcursorBool anim_supported = XcursorSupportsAnim(getDisplay()); if (argb_supported) @@ -205,7 +210,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor(JNIEnv *env, jclass clazz, jobject cursor_handle) { if (cursor_handle != NULL) { Cursor *cursor = (Cursor *)env->GetDirectBufferAddress(cursor_handle); -// Cursor cursor = (Cursor)cursor_handle; current_cursor = *cursor; } else current_cursor = None; @@ -259,14 +263,14 @@ buffer_enabled = false; updatePointerGrab(); initEventQueue(&event_queue); - loadXcursor(); +// loadXcursor(); doWarpPointer(); } JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy (JNIEnv * env, jclass clazz) { - closeXcursor(); +// closeXcursor(); ungrabPointer(); XFreeCursor(getDisplay(), blank_cursor); created = false; --- extxcursor.cpp DELETED --- Index: Makefile.am =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.am 6 Jul 2004 08:06:15 -0000 1.16 +++ Makefile.am 21 Aug 2004 00:18:19 -0000 1.17 @@ -1,6 +1,8 @@ noinst_LTLIBRARIES = libnative.la libnative_la_SOURCES = $(NATIVE) +#libnative_la_LIBADD = -lXrender -lXcursor +#libnative_la_LDFLAGS = -Wl,-static,-lXcursor,-lXrender,-call_shared INCLUDES = -I../common NATIVE = \ @@ -12,6 +14,6 @@ org_lwjgl_opengl_Display.cpp \ org_lwjgl_opengl_Pbuffer.cpp \ display.cpp \ - extgl_glx.cpp \ - extxcursor.cpp + extgl_glx.cpp +# extxcursor.cpp --- extxcursor.h DELETED --- Index: org_lwjgl_input_Cursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Cursor.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_input_Cursor.cpp 30 Jul 2004 13:30:15 -0000 1.15 +++ org_lwjgl_input_Cursor.cpp 21 Aug 2004 00:18:19 -0000 1.16 @@ -39,8 +39,11 @@ * @version $Revision$ */ +#include <X11/X.h> +#include <X11/Xlib.h> +#include <X11/Xcursor/Xcursor.h> #include "org_lwjgl_input_Cursor.h" -#include "extxcursor.h" +//#include "extxcursor.h" #include "Window.h" #include "common_tools.h" |
|
From: Elias N. <eli...@us...> - 2004-08-20 09:03:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24840 Modified Files: Display.java Log Message: Replaced Exception with more specific IllegalAccessException in Display.java Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/Display.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Display.java 3 Jul 2004 14:04:03 -0000 1.6 +++ Display.java 20 Aug 2004 09:03:31 -0000 1.7 @@ -196,9 +196,8 @@ continue; else return -order[i]; - - } catch (Exception e) { - assert false : e.getMessage(); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); } } |
|
From: Elias N. <eli...@us...> - 2004-08-20 08:59:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23962/vector Modified Files: Vector.java Log Message: Replaced assertion with proper exception in Vector.java Index: Vector.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/vector/Vector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vector.java 12 Jun 2004 20:28:29 -0000 1.2 +++ Vector.java 20 Aug 2004 08:58:50 -0000 1.3 @@ -64,12 +64,12 @@ */ public abstract float lengthSquared(); - /** - * Load this vector from a FloatBuffer - * @param buf The buffer to load it from, at the current position - * @return this - */ - public abstract Vector load(FloatBuffer buf); + /** + * Load this vector from a FloatBuffer + * @param buf The buffer to load it from, at the current position + * @return this + */ + public abstract Vector load(FloatBuffer buf); /** * Negate a vector @@ -87,27 +87,25 @@ if (len != 0.0f) { float l = 1.0f / len; return scale(l); - } else { - assert false; - return this; - } + } else + throw new IllegalStateException("Zero length vector"); } - /** - * Store this vector in a FloatBuffer - * @param buf The buffer to store it in, at the current position - * @return this - */ - public abstract Vector store(FloatBuffer buf); + /** + * Store this vector in a FloatBuffer + * @param buf The buffer to store it in, at the current position + * @return this + */ + public abstract Vector store(FloatBuffer buf); - /** - * Scale this vector - * @param scale The scale factor - * @return this - */ - public abstract Vector scale(float scale); + /** + * Scale this vector + * @param scale The scale factor + * @return this + */ + public abstract Vector scale(float scale); |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:26:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4700/src/java/org/lwjgl/opengl Modified Files: ARBProgram.java Log Message: fixed a gazillion imports Index: ARBProgram.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/ARBProgram.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ARBProgram.java 31 Jul 2004 09:34:09 -0000 1.12 +++ ARBProgram.java 20 Aug 2004 06:26:19 -0000 1.13 @@ -32,14 +32,13 @@ package org.lwjgl.opengl; import java.nio.Buffer; -import java.nio.BufferOverflowException; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.LWJGLException; import org.lwjgl.BufferChecks; +import org.lwjgl.LWJGLException; public abstract class ARBProgram { /* |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:23:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/java/org/lwjgl/test/fmod3 Modified Files: NetTest.java DSPTest.java Log Message: fixed a gazillion imports Index: DSPTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3/DSPTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DSPTest.java 20 Aug 2004 06:17:14 -0000 1.2 +++ DSPTest.java 20 Aug 2004 06:22:54 -0000 1.3 @@ -34,7 +34,6 @@ import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; -import java.nio.ByteOrder; import org.lwjgl.fmod3.FMOD; import org.lwjgl.fmod3.FMODException; Index: NetTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3/NetTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NetTest.java 20 Aug 2004 06:17:56 -0000 1.1 +++ NetTest.java 20 Aug 2004 06:22:54 -0000 1.2 @@ -32,7 +32,6 @@ package org.lwjgl.test.fmod3; import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; @@ -40,7 +39,6 @@ import org.lwjgl.fmod3.FMODException; import org.lwjgl.fmod3.FSound; import org.lwjgl.fmod3.FSoundStream; -import org.lwjgl.fmod3.callbacks.FSoundDSPCallback; import org.lwjgl.fmod3.callbacks.FSoundMetaDataCallback; /** |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:23:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/java/org/lwjgl/opengl Modified Files: ARBImaging.java GL12.java Display.java GL11.java GLBufferChecks.java Log Message: fixed a gazillion imports Index: GL11.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL11.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- GL11.java 31 Jul 2004 09:34:09 -0000 1.19 +++ GL11.java 20 Aug 2004 06:22:54 -0000 1.20 @@ -31,17 +31,14 @@ */ package org.lwjgl.opengl; -import org.lwjgl.BufferChecks; - -import java.nio.*; import java.nio.Buffer; -import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; +import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; /** Index: GL12.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL12.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- GL12.java 31 Jul 2004 09:34:09 -0000 1.14 +++ GL12.java 20 Aug 2004 06:22:53 -0000 1.15 @@ -32,14 +32,13 @@ package org.lwjgl.opengl; import java.nio.Buffer; -import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.LWJGLException; import org.lwjgl.BufferChecks; +import org.lwjgl.LWJGLException; /** * $Id$ Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Display.java 9 Aug 2004 11:55:47 -0000 1.21 +++ Display.java 20 Aug 2004 06:22:54 -0000 1.22 @@ -43,17 +43,16 @@ * @author foo */ +import java.nio.FloatBuffer; +import java.util.Arrays; +import java.util.HashSet; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Controller; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import org.lwjgl.LWJGLException; -import org.lwjgl.BufferUtils; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.util.Arrays; -import java.util.HashSet; public final class Display { Index: GLBufferChecks.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLBufferChecks.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- GLBufferChecks.java 29 Jul 2004 11:20:43 -0000 1.1 +++ GLBufferChecks.java 20 Aug 2004 06:22:54 -0000 1.2 @@ -31,12 +31,6 @@ */ package org.lwjgl.opengl; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ShortBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.DoubleBuffer; /** * $Id$ A class to Index: ARBImaging.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/ARBImaging.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ARBImaging.java 31 Jul 2004 09:34:09 -0000 1.10 +++ ARBImaging.java 20 Aug 2004 06:22:53 -0000 1.11 @@ -32,15 +32,14 @@ package org.lwjgl.opengl; import java.nio.Buffer; -import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; +import org.lwjgl.BufferChecks; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; -import org.lwjgl.BufferChecks; /** * $Id$ |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:23:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/java/org/lwjgl/openal Modified Files: ALCcontext.java Log Message: fixed a gazillion imports Index: ALCcontext.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ALCcontext.java 29 Jul 2004 11:30:13 -0000 1.11 +++ ALCcontext.java 20 Aug 2004 06:22:53 -0000 1.12 @@ -31,8 +31,6 @@ */ package org.lwjgl.openal; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:23:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/java/org/lwjgl/examples Modified Files: Game.java Log Message: fixed a gazillion imports Index: Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples/Game.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Game.java 22 Jul 2004 15:34:04 -0000 1.6 +++ Game.java 20 Aug 2004 06:22:53 -0000 1.7 @@ -33,7 +33,6 @@ import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; import org.lwjgl.openal.AL; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:21:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4080 Modified Files: extfmod3.cpp extfmod3.h org_lwjgl_fmod3_FSound.cpp Log Message: more callbacks fixed some methods Index: extfmod3.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/extfmod3.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extfmod3.cpp 12 Aug 2004 21:38:37 -0000 1.3 +++ extfmod3.cpp 20 Aug 2004 06:20:51 -0000 1.4 @@ -54,6 +54,10 @@ // FSound cached fields jmethodID sound_dspcallback; +jmethodID sound_stream_endcallback; +jmethodID sound_stream_synccallback; +jmethodID sound_stream_callback; +jmethodID sound_metadata_callback; jclass fsound; // size of dsp buffer (in bytes) @@ -85,6 +89,10 @@ fsound = env->FindClass("org/lwjgl/fmod3/FSound"); sound_dspcallback = env->GetStaticMethodID(fsound, "dsp_callback", "(JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;"); + sound_stream_endcallback = env->GetStaticMethodID(fsound, "end_callback", "(J)V"); + sound_stream_synccallback = env->GetStaticMethodID(fsound, "sync_callback", "(JLjava/nio/ByteBuffer;I)V"); + sound_stream_callback = env->GetStaticMethodID(fsound, "stream_callback", "(JLjava/nio/ByteBuffer;I)V"); + sound_metadata_callback = env->GetStaticMethodID(fsound, "meta_callback", "(JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V"); // cache some data switch(fmod_instance->FSOUND_GetMixer()) { Index: org_lwjgl_fmod3_FSound.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_fmod3_FSound.cpp 12 Aug 2004 21:38:37 -0000 1.6 +++ org_lwjgl_fmod3_FSound.cpp 20 Aug 2004 06:20:51 -0000 1.7 @@ -33,6 +33,10 @@ #include "extfmod3.h" void * F_CALLBACKAPI fsound_dspcallback(void *originalbuffer, void *newbuffer, int length, void *userdata); +signed char F_CALLBACKAPI fsound_stream_endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param); +signed char F_CALLBACKAPI fsound_stream_synccallback(FSOUND_STREAM *stream, void *buff, int len, void *param); +signed char F_CALLBACKAPI fsound_stream_callback(FSOUND_STREAM *stream, void *buff, int len, void *param); +signed char F_CALLBACKAPI fsound_metadata_callback(char *name,char *value,void *userdata); /* * Class: org_lwjgl_fmod3_FSound @@ -972,7 +976,7 @@ * Signature: (IJJZ)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1PlayEx(JNIEnv * env, jclass clazz, jint channel, jlong stream, jobject dsp, jboolean startpaused) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) env->GetDirectBufferAddress(dsp); + FSOUND_DSPUNIT* nDsp = (dsp != NULL) ? (FSOUND_DSPUNIT*) env->GetDirectBufferAddress(dsp) : NULL; return fmod_instance->FSOUND_Stream_PlayEx(channel, (FSOUND_STREAM*) stream, nDsp, startpaused); } @@ -1219,7 +1223,7 @@ * Method: FSOUND_Stream_Net_SetBufferProperties * Signature: (III)Ljava/lang/String; */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1SetBufferPropertie(JNIEnv * env, jclass clazz, jint buffersize, jint prebuffer_percent, jint rebuffer_percent) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1SetBufferProperties(JNIEnv * env, jclass clazz, jint buffersize, jint prebuffer_percent, jint rebuffer_percent) { return fmod_instance->FSOUND_Stream_Net_SetBufferProperties(buffersize, prebuffer_percent, rebuffer_percent); } @@ -1228,10 +1232,8 @@ * Method: nFSOUND_Stream_Net_SetMetadataCallback * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Net_1SetMetadataCallback(JNIEnv * env, jclass clazz, jlong) { - //XXX - throwFMODException(env, "missing implementation"); - return false; +JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Net_1SetMetadataCallback(JNIEnv * env, jclass clazz, jlong stream) { + return fmod_instance->FSOUND_Stream_Net_SetMetadataCallback((FSOUND_STREAM*) stream, fsound_metadata_callback, (void*) stream); } /* @@ -1262,10 +1264,8 @@ * Method: nFSOUND_Stream_SetEndCallback * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetEndCallback(JNIEnv * env, jclass clazz, jlong) { - //XXX - throwFMODException(env, "missing implementation"); - return false; +JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetEndCallback(JNIEnv * env, jclass clazz, jlong stream) { + return fmod_instance->FSOUND_Stream_SetEndCallback((FSOUND_STREAM*) stream, fsound_stream_endcallback, 0); } /* @@ -1320,10 +1320,8 @@ * Method: FSOUND_Stream_SetSyncCallback * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1SetSyncCallback(JNIEnv * env, jclass clazz, jlong) { - //XXX - throwFMODException(env, "missing implementation"); - return false; +JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1SetSyncCallback(JNIEnv * env, jclass clazz, jlong stream) { + return fmod_instance->FSOUND_Stream_SetSyncCallback((FSOUND_STREAM*) stream, fsound_stream_synccallback, 0); } /* @@ -1813,6 +1811,30 @@ return false; } +/** + * This attaches the mixer thread as a daemon thread, and sets its + * priority to max value + */ +void attachStreamThread() { + jvm->AttachCurrentThreadAsDaemon((void**) &stream_jnienv, NULL); + + // set to high priority + // ============================== + // get current thread + jclass threadClass = stream_jnienv->FindClass("java/lang/Thread"); + jmethodID currentThread = stream_jnienv->GetStaticMethodID(threadClass, "currentThread", "()Ljava/lang/Thread;"); + jobject myThread = stream_jnienv->CallStaticObjectMethod(threadClass, currentThread); + + // get value of high priority + jfieldID highPriority = stream_jnienv->GetStaticFieldID(threadClass, "MAX_PRIORITY", "I"); + jint highPriorityValue = stream_jnienv->GetStaticIntField(threadClass, highPriority); + + // call set priority + jmethodID priority = stream_jnienv->GetMethodID(threadClass, "setPriority", "(I)V"); + stream_jnienv->CallVoidMethod(myThread, priority, highPriorityValue); + // ------------------------------ +} + // FSound callbacks // ======================================= void * F_CALLBACKAPI fsound_dspcallback(void *originalbuffer, void *newbuffer, int length, void *userdata) { @@ -1823,3 +1845,28 @@ jobject resultBuffer = mixer_jnienv->CallStaticObjectMethod(fsound, sound_dspcallback, (jlong) *((long *)userdata), origBuffer, newBuffer, (jint) length); return mixer_jnienv->GetDirectBufferAddress(resultBuffer); } + +signed char F_CALLBACKAPI fsound_stream_endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) { + if (stream_jnienv == NULL) { attachStreamThread(); } + stream_jnienv->CallStaticVoidMethod(fsound, sound_stream_endcallback, (jlong) stream); + return true; +} + +signed char F_CALLBACKAPI fsound_stream_synccallback(FSOUND_STREAM *stream, void *buff, int len, void *param) { + if (stream_jnienv == NULL) { attachStreamThread(); } + int length = strlen((const char *) buff); + stream_jnienv->CallStaticVoidMethod(fsound, sound_stream_synccallback, (jlong) stream, safeNewBuffer(stream_jnienv, buff, length), (jint) len); + return true; +} + +signed char F_CALLBACKAPI fsound_stream_callback(FSOUND_STREAM *stream, void *buff, int len, void *param) { + if (stream_jnienv == NULL) { attachStreamThread(); } + stream_jnienv->CallStaticVoidMethod(fsound, sound_stream_callback, (jlong) stream, safeNewBuffer(stream_jnienv, buff, len), (jint) len); + return true; +} + +signed char F_CALLBACKAPI fsound_metadata_callback(char *name, char *value, void *userdata) { + if (stream_jnienv == NULL) { attachStreamThread(); } + stream_jnienv->CallStaticVoidMethod(fsound, sound_metadata_callback, (jlong) userdata, safeNewBuffer(stream_jnienv, name, strlen(name)), safeNewBuffer(stream_jnienv, value, strlen(value))); + return true; +} \ No newline at end of file Index: extfmod3.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3/extfmod3.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extfmod3.h 12 Aug 2004 21:38:37 -0000 1.3 +++ extfmod3.h 20 Aug 2004 06:20:51 -0000 1.4 @@ -43,6 +43,7 @@ void fmod_destroy(); extern void attachMixerThread(); +extern void attachStreamThread(); extern FMOD_INSTANCE * fmod_instance; // Setup for callback. The callbacks don't have access to a JNIEnv pointer, so we have to provide @@ -63,6 +64,10 @@ // FSound cached fields extern jmethodID sound_dspcallback; +extern jmethodID sound_stream_endcallback; +extern jmethodID sound_stream_synccallback; +extern jmethodID sound_stream_callback; +extern jmethodID sound_metadata_callback; extern jclass fsound; // size of dsp buffer (in bytes) |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:19:39
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/callbacks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3934/src/java/org/lwjgl/fmod3/callbacks Modified Files: FSoundMetaDataCallback.java Log Message: Fixed callback Index: FSoundMetaDataCallback.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/callbacks/FSoundMetaDataCallback.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FSoundMetaDataCallback.java 12 Jun 2004 20:28:21 -0000 1.2 +++ FSoundMetaDataCallback.java 20 Aug 2004 06:19:31 -0000 1.3 @@ -33,8 +33,6 @@ import java.nio.ByteBuffer; -import org.lwjgl.fmod3.FSoundStream; - /** * This interface describes a callback interface to Fmod music * $Id$ @@ -43,5 +41,5 @@ * @version $Revision$ */ public interface FSoundMetaDataCallback { - public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len); + public void FSOUND_METADATACALLBACK(ByteBuffer name, ByteBuffer value); } |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:19:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3824/src/java/org/lwjgl/fmod3 Modified Files: FSound.java Log Message: more callback support fixed some methods Index: FSound.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/FSound.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- FSound.java 12 Aug 2004 21:40:35 -0000 1.5 +++ FSound.java 20 Aug 2004 06:19:11 -0000 1.6 @@ -2435,7 +2435,7 @@ * @param rebuffer_percent How much to rebuffer after a stream has suffered a buffer underrun. Values are expressed as a percentage from 1 to 99. (Default = 95) * @return On success, TRUE is returned. On failure, FALSE is returned. */ - public static native String FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); + public static native boolean FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); /** * Set a metadata callback for an internet stream @@ -2498,7 +2498,8 @@ * @return On success, a channel handle the stream is playing in is returned. On failure, -1 is returned. */ public static int FSOUND_Stream_PlayEx(int channel, FSoundStream stream, FSoundDSPUnit dspunit, boolean paused) { - return nFSOUND_Stream_PlayEx(channel, stream.streamHandle, dspunit.dspHandle, paused); + int res = nFSOUND_Stream_PlayEx(channel, stream.streamHandle, (dspunit != null) ? dspunit.dspHandle : null, paused); + return res; } private static native int nFSOUND_Stream_PlayEx(int channel, long stream, ByteBuffer dspunit, boolean paused); @@ -3586,12 +3587,12 @@ */ private static void end_callback(long streamHandle) { // we got a callback - notify everybody - ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_ENDCALLBACK, streamHandle); - for(int i=0; i<handlers.size(); i++) { - FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i); - FSoundStreamCallback callback = (FSoundStreamCallback) wCallback.callback; - callback.FSOUND_STREAMCALLBACK((FSoundStream) wCallback.handled, null, 0); - } + ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_ENDCALLBACK, streamHandle); + for(int i=0; i<handlers.size(); i++) { + FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i); + FSoundStreamCallback callback = (FSoundStreamCallback) wCallback.callback; + callback.FSOUND_STREAMCALLBACK((FSoundStream) wCallback.handled, null, 0); + } } /** @@ -3685,5 +3686,22 @@ FSoundTellCallback callback = (FSoundTellCallback) wCallback.callback; return callback.FSOUND_TELLCALLBACK(handle); } + + /** + * This is the callback rutine called by the native implementation whenever a + * register callback is notified. + * + * @param handle Handle to native object being monitored + * @param param parameter passed to callback + */ + private static void meta_callback(long streamHandle, ByteBuffer name, ByteBuffer value) { + // we got a callback - notify everybody + ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_METADATACALLBACK, streamHandle); + for(int i=0; i<handlers.size(); i++) { + FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i); + FSoundMetaDataCallback callback = (FSoundMetaDataCallback) wCallback.callback; + callback.FSOUND_METADATACALLBACK(name, value); + } + } // ---------------------------------------------------------- } \ No newline at end of file |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:18:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3729/src/java/org/lwjgl/test/fmod3 Added Files: NetTest.java Log Message: Streaming test --- NEW FILE: NetTest.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.test.fmod3; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.fmod3.FMOD; import org.lwjgl.fmod3.FMODException; import org.lwjgl.fmod3.FSound; import org.lwjgl.fmod3.FSoundStream; import org.lwjgl.fmod3.callbacks.FSoundDSPCallback; import org.lwjgl.fmod3.callbacks.FSoundMetaDataCallback; /** * $Id: NetTest.java,v 1.1 2004/08/20 06:17:56 matzon Exp $ <br> * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class NetTest { public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage:\n NetTest <url>"); // default to monkeyradio.org args = new String[1]; args[0] = "http://207.200.96.227:8038/"; } try { FMOD.create(); } catch (FMODException fmode) { fmode.printStackTrace(); return; } System.out.println("Initializing FMOD"); if (!FSound.FSOUND_Init(44100, 32, 0)) { System.out.println("Failed to initialize FMOD"); System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError())); return; } FSound.FSOUND_Stream_SetBufferSize(100); FSound.FSOUND_Stream_Net_SetBufferProperties(64000, 60, 80); System.out.println("Loading " + args[0]); FSoundStream stream = FSound.FSOUND_Stream_Open(args[0], FSound.FSOUND_NORMAL | FSound.FSOUND_NONBLOCKING, 0, 0); if (stream != null) { int channel = -1; boolean run = true; IntBuffer status = BufferUtils.createIntBuffer(4); while(run) { if(channel < 0) { channel = FSound.FSOUND_Stream_PlayEx(FSound.FSOUND_FREE, stream, null, true); FSound.FSOUND_SetPaused(channel, false); if (channel != -1) { FSound.FSOUND_Stream_Net_SetMetadataCallback(stream, new FSoundMetaDataCallback() { public void FSOUND_METADATACALLBACK(ByteBuffer name, ByteBuffer value) { byte[] charName = new byte[name.capacity()]; name.get(charName); byte[] charValue = new byte[value.capacity()]; value.get(charValue); System.out.println(new String(charName) + " = " + new String(charValue)); } }); } } int openstate = FSound.FSOUND_Stream_GetOpenState(stream); if ((openstate == -1) || (openstate == -3)) { System.out.println("\nERROR: failed to open stream!\n"); System.out.println("SERVER: " + FSound.FSOUND_Stream_Net_GetLastServerStatus() + "\n"); break; } FSound.FSOUND_Stream_Net_GetStatus(stream, status); System.out.println("Status: " + status.get(0) + ", buffer: " + status.get(1) + ", bitrate: " + status.get(2) + ", flags: " + status.get(3)); pause(100); } FSound.FSOUND_Stream_Stop(stream); FSound.FSOUND_Stream_Close(stream); } else { System.out.println("Unable to play: " + args[0]); System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError())); } FSound.FSOUND_Close(); FMOD.destroy(); } /** * @param i */ private static void pause(long i) { try { Thread.sleep(i); } catch (InterruptedException inte) { } } } |
|
From: Brian M. <ma...@us...> - 2004-08-20 06:17:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3667/src/java/org/lwjgl/test/fmod3 Modified Files: DSPTest.java StreamPlayer.java Log Message: cleanup Index: DSPTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3/DSPTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DSPTest.java 12 Aug 2004 21:40:07 -0000 1.1 +++ DSPTest.java 20 Aug 2004 06:17:14 -0000 1.2 @@ -31,8 +31,6 @@ */ package org.lwjgl.test.fmod3; -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; @@ -44,6 +42,7 @@ import org.lwjgl.fmod3.FSoundDSPUnit; import org.lwjgl.fmod3.FSoundStream; import org.lwjgl.fmod3.callbacks.FSoundDSPCallback; +import org.lwjgl.fmod3.callbacks.FSoundStreamCallback; /** * $Id$ <br> @@ -52,7 +51,10 @@ * @version $Revision$ */ public class DSPTest { - + + public static int bytesPerSample; + public static int channels; + public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage:\n DSPTest <file>"); @@ -91,6 +93,47 @@ System.out.println("Created: " + unit); System.out.println("Created: " + unit2); + switch(FSound.FSOUND_GetMixer()) { + case FSound.FSOUND_MIXER_AUTODETECT: + case FSound.FSOUND_MIXER_BLENDMODE: + case FSound.FSOUND_MIXER_QUALITY_AUTODETECT: + case FSound.FSOUND_MIXER_QUALITY_FPU: + case FSound.FSOUND_MIXER_MONO: + case FSound.FSOUND_MIXER_QUALITY_MONO: + case FSound.FSOUND_MIXER_MAX: + bytesPerSample = 8; + break; + default: + bytesPerSample = 4; + break; + } + + channels = FSound.FSOUND_Stream_GetMode(stream); + if((channels & FSound.FSOUND_STEREO) == FSound.FSOUND_STEREO) { + channels = 2; + } else { + channels = 1; + } + + FSound.FSOUND_Stream_SetEndCallback(stream, new FSoundStreamCallback() { + public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len) { + System.out.println("Done"); + } + }); + + FSound.FSOUND_Stream_SetSyncCallback(stream, new FSoundStreamCallback() { + public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len) { + System.out.println("SYNCPOINT"); + try { + byte[] data = new byte[buff.capacity()]; + buff.get(data); + System.out.println("Syncpoint @ " + len + ": " + new String(data)); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + FSound.FSOUND_Stream_Play(0, stream); @@ -113,77 +156,32 @@ FSound.FSOUND_Close(); FMOD.destroy(); } - - /** - * Reads the file into a ByteBuffer - * - * @param filename - * Name of file to load - * @return ByteBuffer containing file data - */ - static protected ByteBuffer getData(String filename) { - ByteBuffer buffer = null; - - System.out.println("Attempting to load: " + filename); - - try { - BufferedInputStream bis = new BufferedInputStream(DSPTest.class.getClassLoader().getResourceAsStream(filename)); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - int bufferLength = 4096; - byte[] readBuffer = new byte[bufferLength]; - int read = -1; - - while ((read = bis.read(readBuffer, 0, bufferLength)) != -1) { - baos.write(readBuffer, 0, read); - } - - //done reading, close - bis.close(); - - // if ogg vorbis data, we need to pass it unmodified to alBufferData - buffer = ByteBuffer.allocateDirect(baos.size()); - buffer.order(ByteOrder.nativeOrder()); - buffer.put(baos.toByteArray()); - buffer.flip(); - System.out.println("loaded " + buffer.remaining() + " bytes"); - } catch (Exception ioe) { - ioe.printStackTrace(); - } - return buffer; - } - - /** - * Creates a ByteBuffer buffer to hold specified bytes - strictly a utility - * method - * - * @param size - * how many bytes to contain - * @return created ByteBuffer - */ - protected static ByteBuffer createByteBuffer(int size) { - ByteBuffer temp = ByteBuffer.allocateDirect(4 * size); - temp.order(ByteOrder.nativeOrder()); - return temp; - } public class TestDspCallback implements FSoundDSPCallback { private String name; - + public TestDspCallback(String name) { - this.name = name; + this.name = name; } /* * @see org.lwjgl.fmod3.callbacks.FSoundDSPCallback#FSOUND_DSPCALLBACK(java.nio.ByteBuffer, java.nio.ByteBuffer, int) */ public ByteBuffer FSOUND_DSPCALLBACK(ByteBuffer originalbuffer, ByteBuffer newbuffer, int length) { - System.out.println("DSP instance called - " + name); - System.out.println("orig: " + originalbuffer.capacity()); - System.out.println("new: " + newbuffer.capacity()); - System.out.println("length: " + length); - return originalbuffer; + short leftChannel; + short rightChannel; + + for(int i=0; i<length; i++) { + leftChannel = originalbuffer.getShort(); + //rightChannel = originalbuffer.getShort(); + + // keep left, mute right channel + newbuffer.putShort(leftChannel); + //newbuffer.putShort(rightChannel); + } + newbuffer.rewind(); + return newbuffer; } } } \ No newline at end of file Index: StreamPlayer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/fmod3/StreamPlayer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- StreamPlayer.java 12 Jun 2004 20:28:25 -0000 1.2 +++ StreamPlayer.java 20 Aug 2004 06:17:15 -0000 1.3 @@ -139,18 +139,4 @@ } return buffer; } - - /** - * Creates a ByteBuffer buffer to hold specified bytes - strictly a utility - * method - * - * @param size - * how many bytes to contain - * @return created ByteBuffer - */ - protected static ByteBuffer createByteBuffer(int size) { - ByteBuffer temp = ByteBuffer.allocateDirect(4 * size); - temp.order(ByteOrder.nativeOrder()); - return temp; - } } \ No newline at end of file |
|
From: Ioannis T. <sp...@us...> - 2004-08-15 23:04:02
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/arb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11813 Modified Files: Makefile.am Added Files: org_lwjgl_opengl_ARBDrawBuffers.cpp Log Message: First GL 2.0 Extensions --- NEW FILE: org_lwjgl_opengl_ARBDrawBuffers.cpp --- /* * 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. */ // ---------------------------------- // IMPLEMENTATION OF NATIVE METHODS FOR CLASS: org.lwjgl.opengl.ARBDrawBuffers // ---------------------------------- #include "extgl.h" typedef void (APIENTRY * glDrawBuffersARBPROC) (GLsizei n, const GLenum *bufs); static glDrawBuffersARBPROC glDrawBuffersARB; /* * Class: org.lwjgl.opengl.ARBDrawBuffers * Method: nglDrawBuffersARB */ static void JNICALL Java_org_lwjgl_opengl_ARBDrawBuffers_nglDrawBuffersARB (JNIEnv * env, jclass clazz, jint size, jobject buffers, jint buffersOffset) { GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffersOffset; glDrawBuffersARB(size, buffers_ptr); } extern "C" { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBDrawBuffers_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglDrawBuffersARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBDrawBuffers_nglDrawBuffersARB, "glDrawBuffersARB", (void**)&glDrawBuffersARB} }; int num_functions = NUMFUNCTIONS(functions); extgl_InitializeClass(env, clazz, num_functions, functions); } } Index: Makefile.am =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/arb/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.am 29 Mar 2004 16:51:29 -0000 1.6 +++ Makefile.am 15 Aug 2004 23:03:54 -0000 1.7 @@ -3,19 +3,20 @@ libarb_la_SOURCES = $(SRC) INCLUDES=-I.. SRC = org_lwjgl_opengl_ARBBufferObject.cpp \ + org_lwjgl_opengl_ARBDrawBuffers.cpp \ org_lwjgl_opengl_ARBProgram.cpp \ - org_lwjgl_opengl_ARBProgram.cpp \ - org_lwjgl_opengl_ARBMatrixPalette.cpp \ - org_lwjgl_opengl_ARBMultisample.cpp \ - org_lwjgl_opengl_ARBMultitexture.cpp \ - org_lwjgl_opengl_ARBPointParameters.cpp \ - org_lwjgl_opengl_ARBProgram.cpp \ - org_lwjgl_opengl_ARBTextureCompression.cpp \ - org_lwjgl_opengl_ARBTransposeMatrix.cpp \ - org_lwjgl_opengl_ARBVertexBlend.cpp \ - org_lwjgl_opengl_ARBVertexProgram.cpp \ - org_lwjgl_opengl_ARBWindowPos.cpp \ - org_lwjgl_opengl_ARBOcclusionQuery.cpp \ - org_lwjgl_opengl_ARBShaderObjects.cpp \ - org_lwjgl_opengl_ARBVertexShader.cpp \ - org_lwjgl_opengl_ARBImaging.cpp + org_lwjgl_opengl_ARBProgram.cpp \ + org_lwjgl_opengl_ARBMatrixPalette.cpp \ + org_lwjgl_opengl_ARBMultisample.cpp \ + org_lwjgl_opengl_ARBMultitexture.cpp \ + org_lwjgl_opengl_ARBPointParameters.cpp \ + org_lwjgl_opengl_ARBProgram.cpp \ + org_lwjgl_opengl_ARBTextureCompression.cpp \ + org_lwjgl_opengl_ARBTransposeMatrix.cpp \ + org_lwjgl_opengl_ARBVertexBlend.cpp \ + org_lwjgl_opengl_ARBVertexProgram.cpp \ + org_lwjgl_opengl_ARBWindowPos.cpp \ + org_lwjgl_opengl_ARBOcclusionQuery.cpp \ + org_lwjgl_opengl_ARBShaderObjects.cpp \ + org_lwjgl_opengl_ARBVertexShader.cpp \ + org_lwjgl_opengl_ARBImaging.cpp |
|
From: Ioannis T. <sp...@us...> - 2004-08-15 23:03:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11631 Modified Files: GLContext.java Added Files: ARBDrawBuffers.java ARBTextureRectangle.java Log Message: First GL 2.0 Extensions --- NEW FILE: ARBDrawBuffers.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; import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; import java.nio.IntBuffer; public final class ARBDrawBuffers { /* * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ public static final int GL_MAX_DRAW_BUFFERS_ARB = 0x8824; public static final int GL_DRAW_BUFFER0_ARB = 0x8825; public static final int GL_DRAW_BUFFER1_ARB = 0x8826; public static final int GL_DRAW_BUFFER2_ARB = 0x8827; public static final int GL_DRAW_BUFFER3_ARB = 0x8828; public static final int GL_DRAW_BUFFER4_ARB = 0x8829; public static final int GL_DRAW_BUFFER5_ARB = 0x882A; public static final int GL_DRAW_BUFFER6_ARB = 0x882B; public static final int GL_DRAW_BUFFER7_ARB = 0x882C; public static final int GL_DRAW_BUFFER8_ARB = 0x882D; public static final int GL_DRAW_BUFFER9_ARB = 0x882E; public static final int GL_DRAW_BUFFER10_ARB = 0x882F; public static final int GL_DRAW_BUFFER11_ARB = 0x8830; public static final int GL_DRAW_BUFFER12_ARB = 0x8831; public static final int GL_DRAW_BUFFER13_ARB = 0x8832; public static final int GL_DRAW_BUFFER14_ARB = 0x8833; public static final int GL_DRAW_BUFFER15_ARB = 0x8834; private ARBDrawBuffers() { } static native void initNativeStubs() throws LWJGLException; // --------------------------- public static void glDrawBuffersARB(IntBuffer buffers) { BufferChecks.checkBuffer(buffers, 1); nglDrawBuffersARB(buffers.remaining(), buffers, buffers.position()); } private static native void nglDrawBuffersARB(int size, IntBuffer buffers, int buffersOffset); // --------------------------- } Index: GLContext.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLContext.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- GLContext.java 29 Jul 2004 15:45:45 -0000 1.27 +++ GLContext.java 15 Aug 2004 23:02:49 -0000 1.28 @@ -1,31 +1,31 @@ -/* +/* * 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 + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * 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 + * * 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 + * 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 + * 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. */ @@ -64,11 +64,12 @@ /* * Available extensions */ - public static boolean GL_ARB_imaging; public static boolean GL_ARB_depth_texture; + public static boolean GL_ARB_draw_buffers; public static boolean GL_ARB_fragment_program; public static boolean GL_ARB_fragment_program_shadow; public static boolean GL_ARB_fragment_shader; + public static boolean GL_ARB_imaging; public static boolean GL_ARB_matrix_palette; public static boolean GL_ARB_multisample; public static boolean GL_ARB_multitexture; @@ -88,6 +89,7 @@ public static boolean GL_ARB_texture_env_dot3; public static boolean GL_ARB_texture_mirrored_repeat; public static boolean GL_ARB_texture_non_power_of_two; + public static boolean GL_ARB_texture_rectangle; public static boolean GL_ARB_transpose_matrix; public static boolean GL_ARB_vertex_blend; public static boolean GL_ARB_vertex_buffer_object; @@ -244,7 +246,7 @@ // Yes, so we don't need to do anything. Our caps and function pointers are still valid. return; } - + // Ok, now it's the current context. if (gl_ref_count == 0) { loadOpenGLLibrary(); @@ -283,7 +285,7 @@ default: break; } - + } addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", ""); String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); @@ -390,7 +392,7 @@ private static native void nLoadOpenGLLibrary() throws LWJGLException; /** - * The OpenGL library reference count is decremented, and if it + * The OpenGL library reference count is decremented, and if it * reaches 0, the library is unloaded. */ public static void unloadOpenGLLibrary() { --- NEW FILE: ARBTextureRectangle.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; public final class ARBTextureRectangle { /* * Accepted by the <cap> parameter of Enable, Disable and * IsEnabled; by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv and GetDoublev; and by the <target> parameter of * BindTexture, GetTexParameterfv, GetTexParameteriv, * TexParameterf, TexParameteri, TexParameterfv and TexParameteriv: * Accepted by the <target> parameter of GetTexImage, * GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D, * CopyTexImage2D, TexSubImage2D and CopySubTexImage2D: */ public static final int GL_TEXTURE_RECTANGLE_ARB = 0x84F5; /* * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv and GetDoublev: */ public static final int GL_TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6; /* * Accepted by the <target> parameter of GetTexLevelParameteriv, * GetTexLevelParameterfv, GetTexParameteriv and TexImage2D: */ public static final int GL_PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7; /* * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv and GetFloatv: */ public static final int GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8; private ARBTextureRectangle() { } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-08-13 15:24:56
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16290/src/java/org/lwjgl Modified Files: Sys.java Log Message: Now ungrabs the mouse when alert() is called Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- Sys.java 12 Aug 2004 15:22:46 -0000 1.55 +++ Sys.java 13 Aug 2004 15:24:47 -0000 1.56 @@ -33,6 +33,8 @@ import java.io.IOException; +import org.lwjgl.input.Mouse; + /** * $Id$ * @@ -200,6 +202,10 @@ * @param message The message text for the alert. */ public static void alert(String title, String message) { + boolean grabbed = Mouse.isGrabbed(); + if (grabbed) { + Mouse.setGrabbed(false); + } String osName = System.getProperty("os.name"); if (osName.startsWith("Windows")) { nAlert(title, message); @@ -211,6 +217,9 @@ Sys.log("Unable to display alert using: " + PLATFORM); } } + if (grabbed) { + Mouse.setGrabbed(true); + } } private static native void nAlert(String title, String message); |
|
From: Brian M. <ma...@us...> - 2004-08-12 21:40:45
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11106 Modified Files: FSound.java FSoundDSPUnit.java FSoundSyncPoint.java Log Message: mo fmod Index: FSoundSyncPoint.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/FSoundSyncPoint.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FSoundSyncPoint.java 12 Jun 2004 20:28:21 -0000 1.2 +++ FSoundSyncPoint.java 12 Aug 2004 21:40:35 -0000 1.3 @@ -31,6 +31,8 @@ */ package org.lwjgl.fmod3; +import java.nio.ByteBuffer; + /** * This class is a representation of a SyncPoint in FMod. * $Id$ @@ -39,15 +41,15 @@ * @version $Revision$ */ public class FSoundSyncPoint { - /** Handle to syncpoint */ - long syncpointHandle; + /** Opaque handle to syncpoint */ + ByteBuffer syncpointHandle; /** * Creates a new FSoundSyncPoint * * @param syncpointHandle handle to syncpoint */ - FSoundSyncPoint(long syncpointHandle) { + FSoundSyncPoint(ByteBuffer syncpointHandle) { this.syncpointHandle = syncpointHandle; } } Index: FSound.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/FSound.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FSound.java 21 Jul 2004 14:47:51 -0000 1.4 +++ FSound.java 12 Aug 2004 21:40:35 -0000 1.5 @@ -36,6 +36,7 @@ import java.nio.IntBuffer; import java.util.ArrayList; +import org.lwjgl.BufferUtils; import org.lwjgl.fmod3.callbacks.FSoundCloseCallback; import org.lwjgl.fmod3.callbacks.FSoundDSPCallback; import org.lwjgl.fmod3.callbacks.FSoundMetaDataCallback; @@ -1275,7 +1276,7 @@ public static int nFSOUND_PlaySoundEx(int channel, FSoundSample sample, FSoundDSPUnit dspunit, boolean startpaused) { return nFSOUND_PlaySoundEx(channel, sample.sampleHandle, dspunit.dspHandle, startpaused); } - private static native int nFSOUND_PlaySoundEx(int channel, long sample, long dspunit, boolean startpaused); + private static native int nFSOUND_PlaySoundEx(int channel, long sample, ByteBuffer dspunit, boolean startpaused); /** * Stops a specified sound channel from playing, and frees it up for re-use @@ -2111,13 +2112,13 @@ * @return On success, a sync point handle is returned. On failure, NULL is returned. */ public static FSoundSyncPoint FSOUND_Stream_AddSyncPoint(FSoundStream stream, int pcmoffset, String name) { - long result = nFSOUND_Stream_AddSyncPoint(stream.streamHandle, pcmoffset, name); - if(result != 0) { + ByteBuffer result = nFSOUND_Stream_AddSyncPoint(stream.streamHandle, pcmoffset, name); + if(result != null) { return new FSoundSyncPoint(result); } return null; } - private static native long nFSOUND_Stream_AddSyncPoint(long streamhandle, int pcmoffset, String name); + private static native ByteBuffer nFSOUND_Stream_AddSyncPoint(long streamhandle, int pcmoffset, String name); /** * Creates a user definable stream file ready for playing. The stream is serviced through a callback @@ -2158,15 +2159,18 @@ * @return On success, a handle to the FSoundDSPUnit is returned. All DSP functions are performable on this. On failure, null is returned */ public static FSoundDSPUnit FSOUND_Stream_CreateDSP(FSoundStream stream, FSoundDSPCallback callback, int priority) { + ByteBuffer dspID = (ByteBuffer) BufferUtils.createByteBuffer(8).putLong(FSoundDSPUnit.getNextId()).flip(); FSoundDSPUnit unit = null; - long result = nFSOUND_Stream_CreateDSP(stream.streamHandle, priority); - if(result != 0) { - unit = new FSoundDSPUnit(result); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, unit.dspHandle, unit, callback); + + ByteBuffer dspHandle = nFSOUND_Stream_CreateDSP(stream.streamHandle, priority, dspID); + + if(dspHandle != null) { + unit = new FSoundDSPUnit(dspHandle, dspID); + FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, dspID.getLong(0), unit, callback); } return unit; } - private static native long nFSOUND_Stream_CreateDSP(long streamHandle, int priority); + private static native ByteBuffer nFSOUND_Stream_CreateDSP(long streamHandle, int priority, ByteBuffer dspID); /** * Removes a user synchronization callback point from a stream. @@ -2177,7 +2181,7 @@ public static boolean FSOUND_Stream_DeleteSyncPoint(FSoundSyncPoint point) { return nFSOUND_Stream_DeleteSyncPoint(point.syncpointHandle); } - private static native boolean nFSOUND_Stream_DeleteSyncPoint(long syncpointHandle); + private static native boolean nFSOUND_Stream_DeleteSyncPoint(ByteBuffer syncpointHandle); /** * Find a tag field associated with an open stream by name and type @@ -2322,13 +2326,13 @@ * @return On success, a handle to a sync point is returned. On failure, NULL is returned. */ public static FSoundSyncPoint FSOUND_Stream_GetSyncPoint(FSoundStream stream, int index) { - long result = nFSOUND_Stream_GetSyncPoint(stream.streamHandle, index); - if(result != 0) { + ByteBuffer result = nFSOUND_Stream_GetSyncPoint(stream.streamHandle, index); + if(result != null) { return new FSoundSyncPoint(result); } return null; } - private static native long nFSOUND_Stream_GetSyncPoint(long streamHandle, int index); + private static native ByteBuffer nFSOUND_Stream_GetSyncPoint(long streamHandle, int index); /** * Retrieves the name and pcm offset in samples for a specified sync point @@ -2342,7 +2346,7 @@ public static String FSOUND_Stream_GetSyncPointInfo(FSoundSyncPoint point, IntBuffer pcmoffset) { return nFSOUND_Stream_GetSyncPointInfo(point.syncpointHandle, pcmoffset, (pcmoffset != null) ? pcmoffset.position() : 0); } - private static native String nFSOUND_Stream_GetSyncPointInfo(long pointHandle, IntBuffer pcmoffset, int bufferOffset); + private static native String nFSOUND_Stream_GetSyncPointInfo(ByteBuffer pointHandle, IntBuffer pcmoffset, int bufferOffset); /** * Get a tag field associated with an open stream @@ -2496,7 +2500,7 @@ public static int FSOUND_Stream_PlayEx(int channel, FSoundStream stream, FSoundDSPUnit dspunit, boolean paused) { return nFSOUND_Stream_PlayEx(channel, stream.streamHandle, dspunit.dspHandle, paused); } - private static native int nFSOUND_Stream_PlayEx(int channel, long stream, long dspunit, boolean paused); + private static native int nFSOUND_Stream_PlayEx(int channel, long stream, ByteBuffer dspunit, boolean paused); /** * Sets the internal file buffersize for audio streaming of data for the NEXT stream opened with FSOUND_Stream_Open. @@ -2916,15 +2920,16 @@ * @return On success, a new valid DSP unit is returned. On failure, NULL is returned. */ public static FSoundDSPUnit FSOUND_DSP_Create(FSoundDSPCallback callbackHandler, int priority) { - FSoundDSPUnit dspUnit = null; - long unit = nFSOUND_DSP_Create(priority); - if(unit != 0) { - dspUnit= new FSoundDSPUnit(unit); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, dspUnit.dspHandle, dspUnit, callbackHandler); + FSoundDSPUnit dspUnit = null; + ByteBuffer handle = nFSOUND_DSP_Create(priority); + if(handle != null) { + ByteBuffer dspID = (ByteBuffer) BufferUtils.createByteBuffer(8).putLong(FSoundDSPUnit.getNextId()).flip(); + dspUnit= new FSoundDSPUnit(handle, dspID); + FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, dspID.getLong(0), dspUnit, callbackHandler); } return dspUnit; } - private static native long nFSOUND_DSP_Create(int priority); + private static native ByteBuffer nFSOUND_DSP_Create(int priority); /** * Frees and removes a DSP unit from the DSP chain @@ -2933,9 +2938,9 @@ */ public static void FSOUND_DSP_Free(FSoundDSPUnit unit) { nFSOUND_DSP_Free(unit.dspHandle); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, unit.dspHandle, unit, null); + FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, unit.dspTrackingID.get(0), unit, null); } - private static native void nFSOUND_DSP_Free(long dspUnitHandle); + private static native void nFSOUND_DSP_Free(ByteBuffer dspUnitHandle); /** * Allows the user to toggle a DSP unit on or off @@ -2949,7 +2954,7 @@ public static void FSOUND_DSP_SetActive(FSoundDSPUnit unit, boolean active) { nFSOUND_DSP_SetActive(unit.dspHandle, active); } - private static native void nFSOUND_DSP_SetActive(long dspUnitHandle, boolean active); + private static native void nFSOUND_DSP_SetActive(ByteBuffer dspUnitHandle, boolean active); /** * Returns if a DSP unit is active or not @@ -2963,7 +2968,7 @@ public static boolean FSOUND_DSP_GetActive(FSoundDSPUnit unit) { return nFSOUND_DSP_GetActive(unit.dspHandle); } - private static native boolean nFSOUND_DSP_GetActive(long dspUnitHandle); + private static native boolean nFSOUND_DSP_GetActive(ByteBuffer dspUnitHandle); /** * Returns the buffer lenth passed by the DSP system to DSP unit callbacks, so you can allocate memory etc @@ -3004,7 +3009,7 @@ public static void FSOUND_DSP_GetActive(FSoundDSPUnit unit, int priority) { nFSOUND_DSP_SetPriority(unit.dspHandle, priority); } - private static native void nFSOUND_DSP_SetPriority(long dspUnitHandle, int priority); + private static native void nFSOUND_DSP_SetPriority(ByteBuffer dspUnitHandle, int priority); /** * Returns the priority status in the DSP chain, of a specified unit. @@ -3019,7 +3024,7 @@ public static int FSOUND_DSP_GetPriority(FSoundDSPUnit unit) { return nFSOUND_DSP_GetPriority(unit.dspHandle); } - private static native int nFSOUND_DSP_GetPriority(long dspUnitHandle); + private static native int nFSOUND_DSP_GetPriority(ByteBuffer dspUnitHandle); /** * Returns a reference to FSOUND's system DSP clear unit @@ -3035,7 +3040,7 @@ } return FMOD.fmodClearUnit; } - private static native long nFSOUND_DSP_GetClearUnit(); + private static native ByteBuffer nFSOUND_DSP_GetClearUnit(); /** * Returns a reference to FSOUND's system Clip and Copy DSP unit @@ -3051,7 +3056,7 @@ } return FMOD.fmodClipAndCopyUnit; } - private static native long nFSOUND_DSP_GetClipAndCopyUnit(); + private static native ByteBuffer nFSOUND_DSP_GetClipAndCopyUnit(); /** * Returns a reference to FSOUND's system DSP Music mixer unit @@ -3067,7 +3072,7 @@ } return FMOD.fmodMusicUnit; } - private static native long nFSOUND_DSP_GetMusicUnit(); + private static native ByteBuffer nFSOUND_DSP_GetMusicUnit(); /** * Returns a reference to FSOUND's system DSP SFX mixer unit @@ -3083,7 +3088,7 @@ } return FMOD.fmodSFXUnit; } - private static native long nFSOUND_DSP_GetSFXUnit(); + private static native ByteBuffer nFSOUND_DSP_GetSFXUnit(); /** * Returns a reference to FSOUND's system DSP FFT processing unit @@ -3100,7 +3105,7 @@ } return FMOD.fmodFFTUnit; } - private static native long nFSOUND_DSP_GetFFTUnit(); + private static native ByteBuffer nFSOUND_DSP_GetFFTUnit(); /** * Function to return a FloatBuffer to the current spectrum buffer. The buffer contains 512 floating @@ -3547,14 +3552,12 @@ * @param handle Handle to native object being monitored * @param param parameter passed to callback */ - private static void dsp_callback(long dspHandle, ByteBuffer originalbuffer, ByteBuffer newbuffer, int length) { + private static ByteBuffer dsp_callback(long dsp_id, ByteBuffer originalbuffer, ByteBuffer newbuffer, int length) { // we got a callback - notify everybody - ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_DSPCALLBACK, dspHandle); - for(int i=0; i<handlers.size(); i++) { - FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i); - FSoundDSPCallback callback = (FSoundDSPCallback) wCallback.callback; - callback.FSOUND_DSPCALLBACK(originalbuffer, newbuffer, length); - } + ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_DSPCALLBACK, dsp_id); + FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get((int)0); + FSoundDSPCallback callback = (FSoundDSPCallback) wCallback.callback; + return callback.FSOUND_DSPCALLBACK(originalbuffer, newbuffer, length); } /** Index: FSoundDSPUnit.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/FSoundDSPUnit.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FSoundDSPUnit.java 12 Jun 2004 20:28:21 -0000 1.2 +++ FSoundDSPUnit.java 12 Aug 2004 21:40:35 -0000 1.3 @@ -31,6 +31,8 @@ */ package org.lwjgl.fmod3; +import java.nio.ByteBuffer; + /** * This class is a representation of a DSPUnit in FMod. * $Id$ @@ -39,15 +41,43 @@ * @version $Revision$ */ public class FSoundDSPUnit { - /** Handle to dsp unit */ - long dspHandle; + /** Opaque handle to dsp unit */ + ByteBuffer dspHandle; + + /** DSP id, used for tracking which dsp needs to call which + * object (when entering from native side) */ + ByteBuffer dspTrackingID; + + /** ID for next dsp unit */ + static long nextDspTrackingID; /** * Creates a new FSoundDSPUnit * * @param dspHandle handle to dsp unit */ - FSoundDSPUnit(long dspHandle) { - this.dspHandle = dspHandle; + FSoundDSPUnit(ByteBuffer dspHandle) { + this.dspHandle = dspHandle; + } + + /** + * Creates a new FSoundDSPUnit + * + * @param dspHandle handle to dsp unit + */ + FSoundDSPUnit(ByteBuffer dspHandle, ByteBuffer dspTrackingID) { + this.dspHandle = dspHandle; + this.dspTrackingID = dspTrackingID; + } + + /** + * @return Next dsp id + */ + static long getNextId() { + // To infinity and beyond!... well almost + if(nextDspTrackingID == Long.MAX_VALUE) { + nextDspTrackingID = 0; + } + return nextDspTrackingID++; } } |