diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-03-22 00:07:51 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-03-22 00:07:51 +0100 |
| commit | aaa904ce3208a6b576f036d99338f9f7dbe054c4 (patch) | |
| tree | ac4b48ab115a2bf7005832d67a8ee5972a3d3321 | |
| parent | 6e1949833e5cf490cff5140b797ce25c3065ed55 (diff) | |
only insert key if printable
| -rw-r--r-- | dmenu-wl.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -413,8 +413,6 @@ handle_keyboard_event() char buf[8]; int genmatch = 0; - xkb_keysym_to_utf8(client.keys.sym, buf, sizeof(buf)); - if (client.keys.state == WL_KEYBOARD_KEY_STATE_PRESSED) { switch (client.keys.sym) { case XKB_KEY_KP_Enter: /* fallthrough */ @@ -431,7 +429,9 @@ handle_keyboard_event() genmatch = 1; break; default: - strncpy(input_field + strlen(input_field), buf, MAX_LINE_LENGTH - strlen(input_field)); + if (xkb_keysym_to_utf8(client.keys.sym, buf, sizeof(buf))) { + strncpy(input_field + strlen(input_field), buf, MAX_LINE_LENGTH - strlen(input_field)); + } genmatch = 1; break; } |