Ignore text events for shortcuts

Pressing Alt+c generates a text event containing "c", so "c" was sent to
the device when --prefer-text was enabled.

Ignore text events when the mod state matches a shortcut modifier.
This commit is contained in:
Romain Vimont 2020-07-17 01:23:08 +02:00
parent e4bb7c1d1f
commit a5f8b577c5
1 changed files with 4 additions and 0 deletions

View File

@ -269,6 +269,10 @@ rotate_client_right(struct screen *screen) {
void
input_manager_process_text_input(struct input_manager *im,
const SDL_TextInputEvent *event) {
if (is_shortcut_mod(im, SDL_GetModState())) {
// A shortcut must never generate text events
return;
}
if (!im->prefer_text) {
char c = event->text[0];
if (isalpha(c) || c == ' ') {