summaryrefslogtreecommitdiffstats
path: root/sway/handlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 938dc3fd..f183c418 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -57,24 +57,27 @@ bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers
57 // Lowercase if necessary 57 // Lowercase if necessary
58 sym = tolower(sym); 58 sym = tolower(sym);
59 59
60 if (state == WLC_KEY_STATE_PRESSED) { 60 int i;
61 int i; 61 for (i = 0; i < mode->bindings->length; ++i) {
62 for (i = 0; i < mode->bindings->length; ++i) { 62 struct sway_binding *binding = mode->bindings->items[i];
63 struct sway_binding *binding = mode->bindings->items[i]; 63
64 64 if ((modifiers->mods & binding->modifiers) == binding->modifiers) {
65 if ((modifiers->mods & binding->modifiers) == binding->modifiers) { 65 bool match = true;
66 bool match = true; 66 int j;
67 int j; 67 for (j = 0; j < binding->keys->length; ++j) {
68 for (j = 0; j < binding->keys->length; ++j) { 68 xkb_keysym_t *k = binding->keys->items[j];
69 xkb_keysym_t *k = binding->keys->items[j]; 69 if (sym != *k) {
70 if (sym != *k) { 70 match = false;
71 match = false; 71 break;
72 break;
73 }
74 } 72 }
73 }
75 74
76 if (match) { 75 if (match) {
77 cmd_success = handle_command(config, binding->command); 76 // TODO: --released
77 if (state == WLC_KEY_STATE_PRESSED) {
78 cmd_success = !handle_command(config, binding->command);
79 } else {
80 cmd_success = true;
78 } 81 }
79 } 82 }
80 } 83 }