Skip to content

Commit 1eeffc5

Browse files
Kontrabantslouken
authored andcommitted
Revert "x11: Send key events for dead keys consumed by the IME"
This and its related commits introduced some bugs and quirks such as duplicated and delayed/missed key events that can't be easily worked around, so revert this for now. This reverts commit 47162a4.
1 parent 3304d24 commit 1eeffc5

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/video/x11/SDL_x11events.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -987,26 +987,29 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
987987
}
988988
}
989989

990-
if (pressed) {
991-
X11_HandleModifierKeys(videodata, scancode, true, true);
992-
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, true);
990+
if (!handled_by_ime) {
991+
if (pressed) {
992+
X11_HandleModifierKeys(videodata, scancode, true, true);
993+
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, true);
994+
995+
if (*text && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
996+
text[text_length] = '\0';
997+
X11_ClearComposition(windowdata);
998+
SDL_SendKeyboardText(text);
999+
}
1000+
} else {
1001+
if (X11_KeyRepeat(display, xevent)) {
1002+
// We're about to get a repeated key down, ignore the key up
1003+
return;
1004+
}
9931005

994-
// Synthesize a text event if the IME didn't consume a printable character
995-
if (*text && !(SDL_GetModState() & (SDL_KMOD_CTRL | SDL_KMOD_ALT))) {
996-
text[text_length] = '\0';
997-
X11_ClearComposition(windowdata);
998-
SDL_SendKeyboardText(text);
1006+
X11_HandleModifierKeys(videodata, scancode, false, true);
1007+
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, false);
9991008
}
1009+
}
10001010

1011+
if (pressed) {
10011012
X11_UpdateUserTime(windowdata, xevent->xkey.time);
1002-
} else {
1003-
if (X11_KeyRepeat(display, xevent)) {
1004-
// We're about to get a repeated key down, ignore the key up
1005-
return;
1006-
}
1007-
1008-
X11_HandleModifierKeys(videodata, scancode, false, true);
1009-
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, keyboardID, keycode, scancode, false);
10101013
}
10111014
}
10121015

0 commit comments

Comments
 (0)