get keybindings working again

develop
Myk Taylor 2023-05-22 17:49:17 -07:00
parent 52151b0e98
commit a48344fd24
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 2 additions and 12 deletions

@ -2373,23 +2373,13 @@ bool Core::DFH_SDL_Event(SDL_Event* ev)
else if (ke.state == SDL_PRESSED && !hotkey_states[ke.keysym.sym]) else if (ke.state == SDL_PRESSED && !hotkey_states[ke.keysym.sym])
{ {
hotkey_states[ke.keysym.sym] = true; hotkey_states[ke.keysym.sym] = true;
SelectHotkey(ke.keysym.sym, modstate);
} }
else if(ke.state == SDL_RELEASED) else if(ke.state == SDL_RELEASED)
{ {
hotkey_states[ke.keysym.sym] = false; hotkey_states[ke.keysym.sym] = false;
} }
} }
else if (ev->type == SDL_TEXTINPUT) {
auto &te = ev->text;
uint8_t sym = (uint8_t)te.text[0];
if (sym <= 0x7f && hotkey_states[sym]) {
// register that we have responded to this hotkey, and don't respond
// again even if the key is held down
hotkey_states[sym] = false;
SelectHotkey(sym, modstate);
}
}
return false; return false;
} }
@ -2408,7 +2398,7 @@ bool Core::SelectHotkey(int sym, int modifiers)
std::string cmd; std::string cmd;
DEBUG(keybinding).print("checking hotkeys for sym=%d, modifiers=%x\n", sym, modifiers); DEBUG(keybinding).print("checking hotkeys for sym=%d (%c), modifiers=%x\n", sym, sym, modifiers);
{ {
std::lock_guard<std::mutex> lock(HotkeyMutex); std::lock_guard<std::mutex> lock(HotkeyMutex);