Added setLocation support for linux

This commit is contained in:
Elias Naur 2004-09-15 17:44:39 +00:00
parent da867ff28a
commit af66408d3d
2 changed files with 20 additions and 6 deletions

View File

@ -11,6 +11,8 @@ extern "C" {
/* Inaccessible static: initial_mode */
/* Inaccessible static: timeNow */
/* Inaccessible static: timeThen */
/* Inaccessible static: x */
/* Inaccessible static: y */
/* Inaccessible static: title */
/* Inaccessible static: fullscreen */
/* Inaccessible static: vsync */
@ -27,10 +29,10 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Display_nGetAvailableDispla
/*
* Class: org_lwjgl_opengl_Display
* Method: nCreateWindow
* Signature: (Lorg/lwjgl/opengl/DisplayMode;Z)V
* Signature: (Lorg/lwjgl/opengl/DisplayMode;ZII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow
(JNIEnv *, jclass, jobject, jboolean);
(JNIEnv *, jclass, jobject, jboolean, jint, jint);
/*
* Class: org_lwjgl_opengl_Display
@ -184,6 +186,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nUpdate
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSetVSyncEnabled
(JNIEnv *, jclass, jboolean);
/*
* Class: org_lwjgl_opengl_Display
* Method: nReshape
* Signature: (IIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nReshape
(JNIEnv *, jclass, jint, jint, jint, jint);
#ifdef __cplusplus
}
#endif

View File

@ -343,7 +343,11 @@ static bool isNetWMFullscreenSupported() {
return supported;
}
static bool createWindow(JNIEnv* env, int width, int height) {
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nReshape(JNIEnv *env, jclass clazz, jint x, jint y, jint width, jint height) {
XMoveWindow(getDisplay(), getCurrentWindow(), x, y);
}
static bool createWindow(JNIEnv* env, int x, int y, int width, int height) {
bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
dirty = true;
focused = true;
@ -370,7 +374,7 @@ static bool createWindow(JNIEnv* env, int width, int height) {
attribmask |= CWOverrideRedirect;
attribs.override_redirect = True;
}
win = XCreateWindow(getDisplay(), root_win, 0, 0, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
win = XCreateWindow(getDisplay(), root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
if (!checkXError(env)) {
XFreeColormap(getDisplay(), cmap);
return false;
@ -706,7 +710,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_destroyContext(JNIEnv *env,
decDisplay();
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, jclass clazz, jobject mode, jboolean fullscreen) {
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, jclass clazz, jobject mode, jboolean fullscreen, int x, int y) {
bool current_fullscreen = fullscreen == JNI_TRUE;
if (current_fullscreen) {
if (getCurrentDisplayModeExtension() == XRANDR && isNetWMFullscreenSupported())
@ -720,7 +724,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env,
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
int width = (*env)->GetIntField(env, mode, fid_width);
int height = (*env)->GetIntField(env, mode, fid_height);
bool window_created = createWindow(env, width, height);
bool window_created = createWindow(env, x, y, width, height);
if (!window_created) {
return;
}