diff --git a/CHANGES b/CHANGES index a3c2472ac50..c388266dc8b 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ - iOS: Fixes Gdx.openURI() not working on iOS 18.1 Simulator. - Change visibility of PolygonSpriteBatch.switchTexture() to protected - Added XmlReader.getChildren() and XmlReader.replaceChild() +- LWJGL3: Fix pauseWhenLostFocus not working as expected - API Addition: Added FPSLogger#setBound [1.13.0] diff --git a/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Window.java b/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Window.java index 8375c4bf5b0..1ce81a32cc2 100644 --- a/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Window.java +++ b/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Window.java @@ -60,29 +60,32 @@ public void invoke (long windowHandle, final boolean focused) { postRunnable(new Runnable() { @Override public void run () { - if (windowListener != null) { - if (focused) { - if (config.pauseWhenLostFocus) { - synchronized (lifecycleListeners) { - for (LifecycleListener lifecycleListener : lifecycleListeners) { - lifecycleListener.resume(); - } + if (focused) { + if (config.pauseWhenLostFocus) { + synchronized (lifecycleListeners) { + for (LifecycleListener lifecycleListener : lifecycleListeners) { + lifecycleListener.resume(); } } + listener.resume(); + } + if (windowListener != null) { windowListener.focusGained(); - } else { + } + } else { + if (windowListener != null) { windowListener.focusLost(); - if (config.pauseWhenLostFocus) { - synchronized (lifecycleListeners) { - for (LifecycleListener lifecycleListener : lifecycleListeners) { - lifecycleListener.pause(); - } + } + if (config.pauseWhenLostFocus) { + synchronized (lifecycleListeners) { + for (LifecycleListener lifecycleListener : lifecycleListeners) { + lifecycleListener.pause(); } - listener.pause(); } + listener.pause(); } - Lwjgl3Window.this.focused = focused; } + Lwjgl3Window.this.focused = focused; } }); }