Apply key rewrite also when keeping key pressed

This commit is contained in:
WisdomCode 2021-09-09 14:57:04 +02:00 committed by GitHub
parent 3ba0533773
commit d8df57130a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -396,18 +396,6 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_MOUSE_BUTTON_PACKET packet
platf::button_mouse(platf_input, button, release);
}
void repeat_key(short key_code) {
// If key no longer pressed, stop repeating
if(!key_press[key_code]) {
key_press_repeat_id = nullptr;
return;
}
platf::keyboard(platf_input, key_code, false);
key_press_repeat_id = task_pool.pushDelayed(repeat_key, config::input.key_repeat_period, key_code).task_id;
}
short map_keycode(short keycode) {
auto it = config::input.keybindings.find(keycode);
if(it != std::end(config::input.keybindings)) {
@ -416,6 +404,18 @@ short map_keycode(short keycode) {
return keycode;
}
void repeat_key(short key_code) {
// If key no longer pressed, stop repeating
if(!key_press[key_code]) {
key_press_repeat_id = nullptr;
return;
}
platf::keyboard(platf_input, map_keycode(keyCode), false);
key_press_repeat_id = task_pool.pushDelayed(repeat_key, config::input.key_repeat_period, key_code).task_id;
}
void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) {
auto constexpr BUTTON_RELEASED = 0x04;