mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-25 23:42:37 +00:00
wayland: Check the mod state when sending repeated key text
The control and alt modifiers should suppress text events when repeating to match standard press behavior.
(cherry picked from commit f07ba5b954)
This commit is contained in:
parent
e61a874c66
commit
5728f9d703
1 changed files with 5 additions and 4 deletions
|
|
@ -417,7 +417,7 @@ static bool keyboard_repeat_handle(SDL_WaylandKeyboardRepeat *repeat_info, Uint6
|
|||
const Uint64 timestamp = repeat_info->base_time_ns + repeat_info->next_repeat_ns;
|
||||
SDL_SendKeyboardKeyIgnoreModifiers(Wayland_AdjustEventTimestampBase(timestamp), repeat_info->keyboard_id, repeat_info->key, repeat_info->scancode, true);
|
||||
}
|
||||
if (repeat_info->text[0]) {
|
||||
if (repeat_info->text[0] && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
|
||||
SDL_SendKeyboardText(repeat_info->text);
|
||||
}
|
||||
repeat_info->next_repeat_ns += SDL_NS_PER_SECOND / (Uint64)repeat_info->repeat_rate;
|
||||
|
|
@ -2272,10 +2272,11 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
|
|||
SDL_SendKeyboardKeyIgnoreModifiers(timestamp_ns, seat->keyboard.sdl_id, key, scancode, state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
if (handled_by_ime) {
|
||||
has_text = false;
|
||||
}
|
||||
if (has_text && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
|
||||
if (!handled_by_ime) {
|
||||
SDL_SendKeyboardText(text);
|
||||
}
|
||||
SDL_SendKeyboardText(text);
|
||||
}
|
||||
if (seat->keyboard.xkb.keymap && WAYLAND_xkb_keymap_key_repeats(seat->keyboard.xkb.keymap, key + 8)) {
|
||||
keyboard_repeat_set(&seat->keyboard.repeat, seat->keyboard.sdl_id, key, time, timestamp_ns, scancode, has_text, text);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue