LemmusLemmus / GlosSI-Integration-Playnite

A Playnite extension that automates creating, launching and closing of GlosSI Steam shortcuts for your games.
GNU General Public License v3.0
27 stars 0 forks source link

GlosSI overlay is delayed in starting, causing the game to lose focus #18

Closed aizakow closed 3 months ago

aizakow commented 1 year ago

Often when I use a Glossi shortcut in Playnite, the game starts and then, after a delay, the glossi overlay kicks in. Sometimes as a result, the steam "first time use" dialog will then trigger and the game will lose focus, and the only way to get back to the game is with a mouse. Is there any way to make the glossi overlay launch simultaneous with the game itself, as it does when using a glossi shortcut on its own?

LemmusLemmus commented 1 year ago

I'm sorry to hear that you are experiencing this problem.

I'm not entirely sure when Steam shows the "first time use" dialog, it seems pretty random to me. Some questions:

  1. Is it only when the "first time use" dialog appears that window focus is stolen?
  2. Is it the "first time use" dialog that steals focus, or is it the GlosSI overlay? This might be hard to discern though..., but is it the GlosSI overlay that ends up with the window focus after focus has been stolen from the game?
  3. Are you by any chance using the Playnite overlay option in fullscreen mode when the problem occurs?
  4. What version of GlosSI are you using?

If I have understood the issue correctly, I could attempt to release a fix in the next version (whenever it will be released...). I see three potential solutions:

  1. It is not possible to launch the overlay simultaneously, but it would be possible to wait for the overlay to start before starting the game. This is what happens if you launch a GlosSI shortcut without the extension. It would be slightly slower though, since the overlay has to finish starting before the game can begin starting.
  2. Wait for the overlay to steal focus from the game, and as soon as it does, return focus to the game. This would be very similar to what is currently done in order to prevent the fullscreen Playnite overlay from taking focus from Playnite (the reliability of this should be improved in the next version btw).
  3. If at all possible, changing GlosSI so that it does not take focus when it is started could be an option.
aizakow commented 1 year ago

1 and 2) Now that you mention it I don’t think it is only when the dialog appears. Rather it is when Glossi initializes, so I suspect it’s the glossi overlay itself stealing focus. 3) I am using the overlay. It seems to happen whether I am using it or not. 4) I’m using the latest, 0.1.2.0

Thanks for your prompt reply!

aizakow commented 1 year ago

It it helps, I have found one game that triggers this seemingly 100% of the time, which is the Game Pass version of Eastward. If you have Game Pass maybe this could help diagnose the issue.

LemmusLemmus commented 1 year ago

This is very late, but it should hopefully be fixed in this experimental version: https://github.com/LemmusLemmus/GlosSI-Integration-Playnite/issues/23#issuecomment-1704314198.

The new version blocks calls to SetForegroundWindow() and then relies on what I previously described as solution 1, by simply waiting for GlosSITarget to finish starting before starting the game (since you wouldn't want to block the game from becoming the foreground window). The wait time has (hopefully) been reduced however, since Steam out of nowhere started supporting the steam://launch/<id> command for non-Steam games as well, and that apparently does not show the annoying "Launching..." window, which made starting games slower for some reason. I have also looked at solution 3 and it is definitely possible, so that option is not entirely off the table for a later version.