Fix linux crash in nGetNativeCursorCaps

This commit is contained in:
Elias Naur 2004-09-21 14:36:52 +00:00
parent e93393ef8a
commit 5361073072
1 changed files with 4 additions and 0 deletions

View File

@ -177,12 +177,16 @@ static void doWarpPointer(int center_x, int center_y) {
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps
(JNIEnv *env, jclass clazz) { (JNIEnv *env, jclass clazz) {
int caps = 0; int caps = 0;
Display *disp = incDisplay(env);
if (disp == NULL)
return caps;
XcursorBool argb_supported = XcursorSupportsARGB(getDisplay()); XcursorBool argb_supported = XcursorSupportsARGB(getDisplay());
XcursorBool anim_supported = XcursorSupportsAnim(getDisplay()); XcursorBool anim_supported = XcursorSupportsAnim(getDisplay());
if (argb_supported) if (argb_supported)
caps |= org_lwjgl_input_Mouse_CURSOR_8_BIT_ALPHA | org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARENCY; caps |= org_lwjgl_input_Mouse_CURSOR_8_BIT_ALPHA | org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARENCY;
if (anim_supported) if (anim_supported)
caps |= org_lwjgl_input_Mouse_CURSOR_ANIMATION; caps |= org_lwjgl_input_Mouse_CURSOR_ANIMATION;
decDisplay();
return caps; return caps;
} }