From 66e0e7053c9ddd947ab63e2bd9c4ae572aedc4db Mon Sep 17 00:00:00 2001 From: Daniel Johansson Date: Thu, 3 Sep 2015 13:31:25 +0100 Subject: [PATCH] Fixed an issue where GLFW would not accept window focus again due to event polling not running. --- .../main/java/com/jme3/system/lwjgl/LwjglWindow.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 4315618b1..6eac34cdc 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/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() { @Override 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) { @@ -200,7 +200,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { wasActive = !wasActive; } - } }); @@ -219,7 +218,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { glfwSwapInterval(0); } - // Make the window visible if (Type.Display.equals(type)) { 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 // it is safe .. for now. @@ -381,7 +377,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { public void run() { if (listener == null) { throw new IllegalStateException("SystemListener is not set on context!" - + "Must set with JmeContext.setSystemListner()."); + + "Must set with JmeContext.setSystemListener()."); } registerNatives();