Skip to content

Commit

Permalink
Fix pauseWhenLostFocus not working as expected (libgdx#7500)
Browse files Browse the repository at this point in the history
  • Loading branch information
obigu authored Dec 20, 2024
1 parent 8dc140d commit 7316afa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
}
Expand Down

0 comments on commit 7316afa

Please sign in to comment.