Skip to content

In local sessions, pause the race when the window leaves focus. - #5660

Open
Big-Blue-Gnu wants to merge 2 commits into
supertuxkart:masterfrom
Big-Blue-Gnu:master
Open

In local sessions, pause the race when the window leaves focus.#5660
Big-Blue-Gnu wants to merge 2 commits into
supertuxkart:masterfrom
Big-Blue-Gnu:master

Conversation

@Big-Blue-Gnu

@Big-Blue-Gnu Big-Blue-Gnu commented Mar 5, 2026

Copy link
Copy Markdown

If you were ever in the middle of a game and you accidentally alt-tabbed out or an application suddenly popped up to steal the focus, chances are you have lost some progress by the time you returned in haste. This change adds a mechanism intended for non-networked sessions. The mechanism, which is triggered when the player is in a race, opens the pause menu and has the same effect as pressing Esc on the keyboard. I only tested the feature on Linux Mint, on which I report no regressions. Non-Linux versions may need testing.

Agreement

By creating a pull request in stk-code, you hereby agree to dual-license your contribution as
GNU General Public License version 3 or any later version and
Mozilla Public License version 2 or any later version.

This includes your previous contribution(s) under the same name of contributor.

In local sessions, pause the race when the game loses focus.
Declare the phase variable inside the condition. No need to have it outside if it goes unused.
@Alayan-stk-2

Alayan-stk-2 commented Mar 15, 2026

Copy link
Copy Markdown
Member

Thank you for your PR!

I think that on the balance of things, this is going to be more useful than not, helping like you said when the focus is lost accidentally.

However, the annoying thing with this is that it makes it impossible to just let the race running on purpose if you want to focus to another window. That's something that can sometimes be convenient, mostly when testing some elements of the game.

So I'd like a new option in the player profile's config.xml that would be checked to determine if the pause should be activated or not upon loss of window focus. A GUI setting is not necessary for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants