diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-23 15:28:49 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-23 15:28:49 -0400 |
commit | 1ac0c8cd47f734809c20bf6a6a0a7278680ed597 (patch) | |
tree | c15286165247ae28a192f66aa5886f1d956c5b07 /sway/handlers.c | |
parent | Merge pull request #123 from Luminarys/master (diff) | |
download | sway-1ac0c8cd47f734809c20bf6a6a0a7278680ed597.tar.gz sway-1ac0c8cd47f734809c20bf6a6a0a7278680ed597.tar.zst sway-1ac0c8cd47f734809c20bf6a6a0a7278680ed597.zip |
Refactor keyboard to consider modified keysyms
Press Shift
Press 0 # Reads as ')'
Release Shift
Release 0 # Reads as '0' but we now recognize it as the same
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 23db5c15..acf3e6a4 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -295,22 +295,12 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
295 | 295 | ||
296 | struct sway_mode *mode = config->current_mode; | 296 | struct sway_mode *mode = config->current_mode; |
297 | 297 | ||
298 | if (sym < 70000 /* bullshit made up number */) { | ||
299 | if (!isalnum(sym) && sym != ' ' && sym != XKB_KEY_Escape && sym != XKB_KEY_Tab) { | ||
300 | // God fucking dammit | ||
301 | return false; | ||
302 | } | ||
303 | } | ||
304 | |||
305 | // Lowercase if necessary | ||
306 | sym = tolower(sym); | ||
307 | |||
308 | int i; | 298 | int i; |
309 | 299 | ||
310 | if (state == WLC_KEY_STATE_PRESSED) { | 300 | if (state == WLC_KEY_STATE_PRESSED) { |
311 | press_key(sym); | 301 | press_key(sym, key); |
312 | } else { // WLC_KEY_STATE_RELEASED | 302 | } else { // WLC_KEY_STATE_RELEASED |
313 | release_key(sym); | 303 | release_key(sym, key); |
314 | } | 304 | } |
315 | 305 | ||
316 | // TODO: reminder to check conflicts with mod+q+a versus mod+q | 306 | // TODO: reminder to check conflicts with mod+q+a versus mod+q |
@@ -322,7 +312,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
322 | int j; | 312 | int j; |
323 | for (j = 0; j < binding->keys->length; ++j) { | 313 | for (j = 0; j < binding->keys->length; ++j) { |
324 | xkb_keysym_t *key = binding->keys->items[j]; | 314 | xkb_keysym_t *key = binding->keys->items[j]; |
325 | if ((match = check_key(*key)) == false) { | 315 | if ((match = check_key(*key, 0)) == false) { |
326 | break; | 316 | break; |
327 | } | 317 | } |
328 | } | 318 | } |