Windows: Generalized WindowsDispaly.nCreateWindow

This commit is contained in:
Elias Naur 2008-05-05 16:46:16 +00:00
parent b6b83936ac
commit 5e06f19944
3 changed files with 4 additions and 9 deletions

View File

@ -45,7 +45,7 @@ import org.lwjgl.opengl.Display;
* $Id$ * $Id$
*/ */
final class WindowsSysImplementation extends DefaultSysImplementation { final class WindowsSysImplementation extends DefaultSysImplementation {
private final static int JNI_VERSION = 18; private final static int JNI_VERSION = 19;
static { static {
Sys.initialize(); Sys.initialize();

View File

@ -164,7 +164,7 @@ final class WindowsDisplay implements DisplayImplementation {
this.parent = parent; this.parent = parent;
long parent_hwnd = parent != null ? getHwnd(parent) : 0; long parent_hwnd = parent != null ? getHwnd(parent) : 0;
boolean isUndecorated = isUndecorated(); boolean isUndecorated = isUndecorated();
this.hwnd = nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent != null, parent_hwnd); this.hwnd = nCreateWindow(fullscreen, x, y, mode.getWidth(), mode.getHeight(), isUndecorated, parent != null, parent_hwnd);
if (hwnd == 0) { if (hwnd == 0) {
throw new LWJGLException("Failed to create window"); throw new LWJGLException("Failed to create window");
} }
@ -187,7 +187,7 @@ final class WindowsDisplay implements DisplayImplementation {
throw e; throw e;
} }
} }
private native long nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private native long nCreateWindow(boolean fullscreen, int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() { private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");

View File

@ -158,12 +158,7 @@ static void destroyWindow(JNIEnv *env, HWND *hwnd, HDC *hdc) {
(*env)->DeleteGlobalRef(env, display_class_global); (*env)->DeleteGlobalRef(env, display_class_global);
} }
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y, jboolean undecorated, jboolean child_window, jlong parent_hwnd) { JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jboolean fullscreen, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
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);
HWND hwnd; HWND hwnd;
static bool oneShotInitialised = false; static bool oneShotInitialised = false;
if (!oneShotInitialised) { if (!oneShotInitialised) {