Fixed an issue where GLFW would not accept window focus again due to event polling not running.

experimental
Daniel Johansson 10 years ago
parent 971b9524bd
commit 66e0e7053c
  1. 10
      jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java

@ -188,7 +188,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
glfwSetWindowFocusCallback(window, windowFocusCallback = new GLFWWindowFocusCallback() { glfwSetWindowFocusCallback(window, windowFocusCallback = new GLFWWindowFocusCallback() {
@Override @Override
public void invoke(final long window, final int focused) { public void invoke(final long window, final int focused) {
final boolean focus = (focused == 1); final boolean focus = (focused == GL_TRUE);
if (wasActive != focus) { if (wasActive != focus) {
if (!wasActive) { if (!wasActive) {
@ -200,7 +200,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
wasActive = !wasActive; wasActive = !wasActive;
} }
} }
}); });
@ -219,7 +218,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
glfwSwapInterval(0); glfwSwapInterval(0);
} }
// Make the window visible // Make the window visible
if (Type.Display.equals(type)) { if (Type.Display.equals(type)) {
glfwShowWindow(window); glfwShowWindow(window);
@ -356,9 +354,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
} }
} }
if (glfwGetWindowAttrib(window, GLFW_FOCUSED) == GL_TRUE) { glfwPollEvents();
glfwPollEvents();
}
// Subclasses just call GLObjectManager clean up objects here // Subclasses just call GLObjectManager clean up objects here
// it is safe .. for now. // it is safe .. for now.
@ -381,7 +377,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
public void run() { public void run() {
if (listener == null) { if (listener == null) {
throw new IllegalStateException("SystemListener is not set on context!" throw new IllegalStateException("SystemListener is not set on context!"
+ "Must set with JmeContext.setSystemListner()."); + "Must set with JmeContext.setSystemListener().");
} }
registerNatives(); registerNatives();

Loading…
Cancel
Save