diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java index 4cbd59a4..7b399474 100644 --- a/src/java/org/lwjgl/opengl/LinuxDisplay.java +++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java @@ -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(); } } diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/org_lwjgl_opengl_Display.c index 7555a9c7..af8c4115 100644 --- a/src/native/linux/org_lwjgl_opengl_Display.c +++ b/src/native/linux/org_lwjgl_opengl_Display.c @@ -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;