Linux: When creating a window don't loop waiting for the MapNotify event. Instead, make sure we don't immediately go from fullscreen to minimized by checking if the window has been focused at least once before minimizing (and resetting display mode).

This commit is contained in:
Elias Naur 2007-02-23 10:14:18 +00:00
parent a5c8a3d6af
commit 4bf4a385f3
2 changed files with 4 additions and 9 deletions

View File

@ -110,6 +110,7 @@ final class LinuxDisplay implements DisplayImplementation {
private boolean minimized;
private boolean dirty;
private boolean close_requested;
private boolean focused_at_least_once;
private long current_cursor;
private long blank_cursor;
@ -398,6 +399,7 @@ final class LinuxDisplay implements DisplayImplementation {
pointer_grabbed = false;
keyboard_grabbed = false;
close_requested = false;
focused_at_least_once = false;
grab = false;
minimized = false;
dirty = true;
@ -750,8 +752,9 @@ final class LinuxDisplay implements DisplayImplementation {
private void checkInput() {
focused = nGetInputFocus(getDisplay()) == getWindow();
if (focused) {
focused_at_least_once = true;
acquireInput();
} else {
} else if (focused_at_least_once) {
releaseInput();
}
}

View File

@ -127,13 +127,6 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *e
return atom;
}
static void waitMapped(Display *disp, Window win) {
XEvent event;
do {
XMaskEvent(disp, StructureNotifyMask, &event);
} while ((event.type != MapNotify) || (event.xmap.event != win));
}
static void __attribute__ ((destructor)) my_fini(void) {
Display *disp = XOpenDisplay(NULL);
if (disp == NULL) {
@ -294,7 +287,6 @@ static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_m
XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1);
}
XMapRaised(disp, win);
waitMapped(disp, win);
if (!checkXError(env, disp)) {
destroyWindow(env, disp, win);
return 0;