mirror of https://github.com/libsdl-org/SDL.git
Don't send text event while ctrl/alt is held on X11/Wayland
This commit is contained in:
parent
365b7837c2
commit
ac5b2b6102
|
|
@ -1886,7 +1886,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
|
||||||
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, key, scancode, state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, key, scancode, state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
|
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
if (has_text && !(SDL_GetModState() & SDL_KMOD_CTRL)) {
|
if (has_text && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
|
||||||
if (!handled_by_ime) {
|
if (!handled_by_ime) {
|
||||||
SDL_SendKeyboardText(text);
|
SDL_SendKeyboardText(text);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -977,7 +977,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
|
||||||
X11_HandleModifierKeys(videodata, scancode, true, true);
|
X11_HandleModifierKeys(videodata, scancode, true, true);
|
||||||
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, true);
|
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, true);
|
||||||
|
|
||||||
if (*text) {
|
if (*text && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
|
||||||
text[text_length] = '\0';
|
text[text_length] = '\0';
|
||||||
X11_ClearComposition(windowdata);
|
X11_ClearComposition(windowdata);
|
||||||
SDL_SendKeyboardText(text);
|
SDL_SendKeyboardText(text);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue