[Fix] possible fix to Heroic does not stay minimized #5611#5646
Open
MateoGonzalezLourido wants to merge 1 commit into
Open
[Fix] possible fix to Heroic does not stay minimized #5611#5646MateoGonzalezLourido wants to merge 1 commit into
MateoGonzalezLourido wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<--- Put the description here --->
What
Fixes the "minimize on launch" feature not maintaining the hidden state on
subsequent game launches without reopening Heroic.
related to #5611
Root cause
launchEventCallbackcalledmainWindow.hide()unconditionally wheneverminimizeOnLaunch && !noTrayIcon, with no check for whether the window wasalready hidden.
After the first game exits, the window stays hidden (there is no
show()callin the exit path). On the second launch — e.g. from the tray icon's
"Recent Games" context menu, without explicitly reopening Heroic —
hide()wascalled on an already-hidden window ( this causes the
window to briefly flash with a frozen/blank background before the game starts and leaves the window state inconsistent for subsequent launches.).
protocol.tsalready guards against this with anisVisible()check(lines 128-134);
launchEventCallbackwas missing the same guard.Changes
src/backend/launcher.tsAdded
mainWindow?.isVisible()guard before callinghide(), consistentwith the pattern already used in
protocol.ts. This prevents callinghide()on an already-hidden window, which caused the blank-window flash and
inconsistent state on Linux.
Fixed
powerDisplayIdnever being reset tonullafterpowerSaveBlocker.stop(). Because of this, starting from the third gamelaunch the guard
if (!powerDisplayId)evaluated tofalse(non-zero integeris truthy), silently skipping the display-sleep blocker for all subsequent
sessions.
I can't test it.It works just as well on my PC as the original.
Use the following Checklist if you have changed something on the Backend or Frontend: