diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 11 | ||||
-rw-r--r-- | sway/input/keyboard.c | 9 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 26cf5035..7b19991b 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -369,3 +369,14 @@ void sway_input_manager_configure_xcursor(struct sway_input_manager *input) { | |||
369 | sway_seat_configure_xcursor(seat); | 369 | sway_seat_configure_xcursor(seat); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | |||
373 | struct sway_seat *sway_input_manager_get_default_seat( | ||
374 | struct sway_input_manager *input) { | ||
375 | struct sway_seat *seat = NULL; | ||
376 | wl_list_for_each(seat, &input->seats, link) { | ||
377 | if (strcmp(seat->wlr_seat->name, "seat0") == 0) { | ||
378 | return seat; | ||
379 | } | ||
380 | } | ||
381 | return seat; | ||
382 | } | ||
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 5827a1ca..6dc57d46 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -89,9 +89,12 @@ static bool binding_matches_key_state(struct sway_binding *binding, | |||
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | 91 | ||
92 | static void binding_execute_command(struct sway_binding *binding) { | 92 | static void keyboard_execute_command(struct sway_keyboard *keyboard, |
93 | struct sway_binding *binding) { | ||
93 | wlr_log(L_DEBUG, "running command for binding: %s", | 94 | wlr_log(L_DEBUG, "running command for binding: %s", |
94 | binding->command); | 95 | binding->command); |
96 | config_clear_handler_context(config); | ||
97 | config->handler_context.seat = keyboard->seat_device->sway_seat; | ||
95 | struct cmd_results *results = handle_command(binding->command); | 98 | struct cmd_results *results = handle_command(binding->command); |
96 | if (results->status != CMD_SUCCESS) { | 99 | if (results->status != CMD_SUCCESS) { |
97 | wlr_log(L_DEBUG, "could not run command for binding: %s", | 100 | wlr_log(L_DEBUG, "could not run command for binding: %s", |
@@ -160,7 +163,7 @@ static bool keyboard_execute_bindsym(struct sway_keyboard *keyboard, | |||
160 | } | 163 | } |
161 | 164 | ||
162 | if (match) { | 165 | if (match) { |
163 | binding_execute_command(binding); | 166 | keyboard_execute_command(keyboard, binding); |
164 | return true; | 167 | return true; |
165 | } | 168 | } |
166 | } | 169 | } |
@@ -267,7 +270,7 @@ static bool keyboard_execute_bindcode(struct sway_keyboard *keyboard, | |||
267 | for (int i = 0; i < keycode_bindings->length; ++i) { | 270 | for (int i = 0; i < keycode_bindings->length; ++i) { |
268 | struct sway_binding *binding = keycode_bindings->items[i]; | 271 | struct sway_binding *binding = keycode_bindings->items[i]; |
269 | if (binding_matches_keycodes(wlr_keyboard, binding, event)) { | 272 | if (binding_matches_keycodes(wlr_keyboard, binding, event)) { |
270 | binding_execute_command(binding); | 273 | keyboard_execute_command(keyboard, binding); |
271 | return true; | 274 | return true; |
272 | } | 275 | } |
273 | } | 276 | } |