Open ItsJustSomeDude opened 2 days ago
not all versions of the game pause on focus loss, so it is simply easier to send the escape event so that it works uniformly across everything that pojav can run
and i dont feel like making a button to turn that off yet
Apologies for immediately adding a comment.
It seems the Escape key is being sent during onPause() lifecycle hook right here: https://github.com/PojavLauncherTeam/PojavLauncher/blob/v3_openjdk/app_pojavlauncher%2Fsrc%2Fmain%2Fjava%2Fnet%2Fkdt%2Fpojavlaunch%2FMainActivity.java#L271
It seems to me that instead of sending ESC, the game window can simply be informed that it is in the background (like it looks like is being done onStop several lines below that), and will thus let Pause on Lost Focus pause the game, if the user hasn't disabled that.
I'll try building a version with this line removed to see if there are any unforseen consequences. (Perhaps a "cursor release" has to be sent instead?) If everything still works I'll be happy to PR this!
The problem is that (iirc) older versions dont care about window focus, which is why this was initially implemented as an esc keypress.
Describe the bug
The vanilla "pause on lost focus" setting is ignored when the app is backgrounded. This means things like AFK farms that require a button to be held down (such as Tree farms or AFK Fish farms, or walking while AFK) cannot be done in the background. A key can be held in the background either with a toggleable button, or with the F3+T trick. However, the actions stop as soon as the activity is in the background.
The log file and images/videos
latest.log
Steps To Reproduce
Expected Behavior
The app should be able to enter the background without an Escape key event being sent to the game.
Platform
Anything else?
No response