wayland: Pass the keyboard ID through to repeat events

This commit is contained in:
Frank Praznik 2024-03-24 08:49:29 -04:00
parent 0df0462d0a
commit 9e460ce6a6
1 changed files with 3 additions and 2 deletions

View File

@ -286,13 +286,14 @@ static void keyboard_repeat_clear(SDL_WaylandKeyboardRepeat *repeat_info)
repeat_info->is_key_down = SDL_FALSE; repeat_info->is_key_down = SDL_FALSE;
} }
static void keyboard_repeat_set(SDL_WaylandKeyboardRepeat *repeat_info, uint32_t key, Uint64 wl_press_time_ns, static void keyboard_repeat_set(SDL_WaylandKeyboardRepeat *repeat_info, Uint32 keyboard_id, uint32_t key, Uint64 wl_press_time_ns,
uint32_t scancode, SDL_bool has_text, char text[8]) uint32_t scancode, SDL_bool has_text, char text[8])
{ {
if (!repeat_info->is_initialized || !repeat_info->repeat_rate) { if (!repeat_info->is_initialized || !repeat_info->repeat_rate) {
return; return;
} }
repeat_info->is_key_down = SDL_TRUE; repeat_info->is_key_down = SDL_TRUE;
repeat_info->keyboard_id = keyboard_id;
repeat_info->key = key; repeat_info->key = key;
repeat_info->wl_press_time_ns = wl_press_time_ns; repeat_info->wl_press_time_ns = wl_press_time_ns;
repeat_info->sdl_press_time_ns = SDL_GetTicksNS(); repeat_info->sdl_press_time_ns = SDL_GetTicksNS();
@ -1631,7 +1632,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
} }
} }
if (input->xkb.keymap && WAYLAND_xkb_keymap_key_repeats(input->xkb.keymap, key + 8)) { if (input->xkb.keymap && WAYLAND_xkb_keymap_key_repeats(input->xkb.keymap, key + 8)) {
keyboard_repeat_set(&input->keyboard_repeat, key, timestamp_raw_ns, scancode, has_text, text); keyboard_repeat_set(&input->keyboard_repeat, input->keyboard_id, key, timestamp_raw_ns, scancode, has_text, text);
} }
} }
} }