mirror of
https://github.com/LIV2/amiberry.git
synced 2025-12-06 06:32:45 +00:00
Alt tab release (#1460)
* added reset keyboard during release_keys * trigger a key-up on all scancodes
This commit is contained in:
parent
aada2f3e69
commit
b5129e7aa0
@ -760,16 +760,31 @@ static void close_kb()
|
||||
|
||||
void release_keys(void)
|
||||
{
|
||||
SDL_PumpEvents();
|
||||
// only run this if SDL2 version is 2.24 or higher
|
||||
#if SDL_VERSION_ATLEAST(2,0,24)
|
||||
SDL_ResetKeyboard();
|
||||
#else
|
||||
{
|
||||
const Uint8* state = SDL_GetKeyboardState(NULL);
|
||||
SDL_Event event;
|
||||
|
||||
//for (int j = 0; j < MAX_INPUT_DEVICES; j++) {
|
||||
// for (int i = 0; i < MAX_KEYCODES; i++) {
|
||||
// if (di_keycodes[j][i]) {
|
||||
// di_keycodes[j][i] = 0;
|
||||
// my_kbd_handler(j, i, 0, true);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
for (int i = 0; i < SDL_NUM_SCANCODES; ++i) {
|
||||
if (state[i]) {
|
||||
event.type = SDL_KEYUP;
|
||||
event.key.keysym.scancode = (SDL_Scancode)i;
|
||||
event.key.keysym.sym = SDL_GetKeyFromScancode((SDL_Scancode)i);
|
||||
event.key.keysym.mod = 0;
|
||||
event.key.state = SDL_RELEASED;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int j = 0; j < MAX_INPUT_DEVICES; j++) {
|
||||
for (int i = 0; i < SDL_NUM_SCANCODES; i++) {
|
||||
my_kbd_handler(j, i, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int acquire_kb(const int num, int flags)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user