diff options
Diffstat (limited to 'sway/input/switch.c')
-rw-r--r-- | sway/input/switch.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sway/input/switch.c b/sway/input/switch.c index a8769713..d825c5c3 100644 --- a/sway/input/switch.c +++ b/sway/input/switch.c | |||
@@ -38,6 +38,7 @@ static void handle_switch_toggle(struct wl_listener *listener, void *data) { | |||
38 | sway_log(SWAY_DEBUG, "%s: type %d state %d", device_identifier, type, state); | 38 | sway_log(SWAY_DEBUG, "%s: type %d state %d", device_identifier, type, state); |
39 | 39 | ||
40 | list_t *bindings = config->current_mode->switch_bindings; | 40 | list_t *bindings = config->current_mode->switch_bindings; |
41 | struct sway_switch_binding *matched_binding = NULL; | ||
41 | for (int i = 0; i < bindings->length; ++i) { | 42 | for (int i = 0; i < bindings->length; ++i) { |
42 | struct sway_switch_binding *binding = bindings->items[i]; | 43 | struct sway_switch_binding *binding = bindings->items[i]; |
43 | if (binding->type != type) { | 44 | if (binding->type != type) { |
@@ -52,10 +53,19 @@ static void handle_switch_toggle(struct wl_listener *listener, void *data) { | |||
52 | continue; | 53 | continue; |
53 | } | 54 | } |
54 | 55 | ||
55 | struct sway_binding *dummy_binding = calloc(1, sizeof(struct sway_binding)); | 56 | matched_binding = binding; |
57 | |||
58 | if (binding_locked == input_inhibited) { | ||
59 | break; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | if (matched_binding) { | ||
64 | struct sway_binding *dummy_binding = | ||
65 | calloc(1, sizeof(struct sway_binding)); | ||
56 | dummy_binding->type = BINDING_SWITCH; | 66 | dummy_binding->type = BINDING_SWITCH; |
57 | dummy_binding->flags = binding->flags; | 67 | dummy_binding->flags = matched_binding->flags; |
58 | dummy_binding->command = binding->command; | 68 | dummy_binding->command = matched_binding->command; |
59 | 69 | ||
60 | seat_execute_command(seat, dummy_binding); | 70 | seat_execute_command(seat, dummy_binding); |
61 | free(dummy_binding); | 71 | free(dummy_binding); |