Open assertivist opened 3 years ago
Thanks for the workaround @yorb !
Thanks to your info, I think I finally know how to fix this https://wiki.libsdl.org/SDL_HINT_GRAB_KEYBOARD
basically there is an SDL hint that will prevent any keyboard events from reaching anything but our app. This would make it so that ALT+TAB, volume keys etc. would not work while playing Avara, BUT you could use Left GUI and Right GUI as keys without triggering OS shortcuts.
The idea being (I need to research to see if this is possible without regenerating the SDL window) we would 'grab' the keyboard during gameplay and 'release' it in-between games so you can switch apps and change the volume and stuff with the keyboard again.
Anybody with strong thoughts on this?
We might be able to patch mainloop to check to see if there's an active game, and just ignore the SDL_QUIT event in that case. But if that doesn't work for some reason, we could grab the keyboard, but it should probably either be a preference, or only be done if you actually have command/win/meta bound.
We might be able to patch mainloop to check to see if there's an active game, and just ignore the SDL_QUIT event in that case. But if that doesn't work for some reason, we could grab the keyboard, but it should probably either be a preference, or only be done if you actually have command/win/meta bound.
If we go with the first route, we'll have to catch more than just Quit:
These are all ones that have happened to me in-game, but I'm sure there are plenty of other possibilities.
I figured out a workaround for this, because I wanted to use Left Command as jump but it also closes the window:
This disables the Close shortcut until you quit. ~Unfortunately you have to redo this every time you reopen Avara (set the shortcut to something else, switch to Avara and back, set the shortcut back to ⌘W).~
Edit: Found a better workaround here, updated steps above. Set once and done.