Alt tab fixes (#1471)

* Add key-up event for Alt-Tab in Release keys

If Alt-Tab to Release is enabled, force a key-up event on those keys during the release_keys() function

* only release Alt-Tab if Alt was detected as pressed

We don't have Tab as a qualifier, but this is probably close enough

* Removed duplicate releasing of alt-tab keys

This shouldn't be needed anymore
This commit is contained in:
Dimitris Panokostas 2024-10-11 12:52:37 +02:00 committed by GitHub
parent 8c65d69057
commit 613c3002a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -360,10 +360,6 @@ int keyhack (const int scancode, const int pressed, const int num)
if (currprefs.alt_tab_release)
{
if (pressed && state[SDL_SCANCODE_LALT] && scancode == SDL_SCANCODE_TAB) {
// Ensure we release Alt-Tab before we release capture
inputdevice_translatekeycode(num, SDL_SCANCODE_TAB, 0, true);
inputdevice_translatekeycode(num, SDL_SCANCODE_LALT, 0, true);
disablecapture();
return -1;
}
@ -764,6 +760,13 @@ static void close_kb()
void release_keys(void)
{
// Special handling in case Alt-Tab was still stuck in pressed state
if (currprefs.alt_tab_release && key_altpressed())
{
my_kbd_handler(0, SDL_SCANCODE_LALT, 0, true);
my_kbd_handler(0, SDL_SCANCODE_TAB, 0, true);
}
const Uint8* state = SDL_GetKeyboardState(NULL);
SDL_Event event;