diff options
author | emersion <contact@emersion.fr> | 2018-01-22 01:16:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 01:16:23 +0100 |
commit | 0c58673c6a108ba241419a0f1d5fecd47f22370e (patch) | |
tree | c3e19af6dd70f04fc5c617e932b4afcc7a1b41d9 /sway/input | |
parent | Remove sway/old/ (diff) | |
parent | dont allow kill command in config (diff) | |
download | sway-0c58673c6a108ba241419a0f1d5fecd47f22370e.tar.gz sway-0c58673c6a108ba241419a0f1d5fecd47f22370e.tar.zst sway-0c58673c6a108ba241419a0f1d5fecd47f22370e.zip |
Merge pull request #1574 from acrisci/config-refactor
Command criteria
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 11 | ||||
-rw-r--r-- | sway/input/keyboard.c | 9 | ||||
-rw-r--r-- | sway/input/seat.c | 5 |
3 files changed, 19 insertions, 6 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index bfe9d9c4..2d119cf2 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -372,3 +372,14 @@ void sway_input_manager_configure_xcursor(struct sway_input_manager *input) { | |||
372 | sway_seat_configure_xcursor(seat); | 372 | sway_seat_configure_xcursor(seat); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | |||
376 | struct sway_seat *sway_input_manager_get_default_seat( | ||
377 | struct sway_input_manager *input) { | ||
378 | struct sway_seat *seat = NULL; | ||
379 | wl_list_for_each(seat, &input->seats, link) { | ||
380 | if (strcmp(seat->wlr_seat->name, "seat0") == 0) { | ||
381 | return seat; | ||
382 | } | ||
383 | } | ||
384 | return seat; | ||
385 | } | ||
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 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 22fee3c3..e9b375e0 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -214,7 +214,7 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { | |||
214 | 214 | ||
215 | if (container) { | 215 | if (container) { |
216 | struct sway_view *view = container->sway_view; | 216 | struct sway_view *view = container->sway_view; |
217 | view->iface.set_activated(view, true); | 217 | view_set_activated(view, true); |
218 | wl_signal_add(&container->events.destroy, &seat->focus_destroy); | 218 | wl_signal_add(&container->events.destroy, &seat->focus_destroy); |
219 | seat->focus_destroy.notify = handle_focus_destroy; | 219 | seat->focus_destroy.notify = handle_focus_destroy; |
220 | 220 | ||
@@ -234,8 +234,7 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { | |||
234 | if (last_focus && | 234 | if (last_focus && |
235 | !sway_input_manager_has_focus(seat->input, last_focus)) { | 235 | !sway_input_manager_has_focus(seat->input, last_focus)) { |
236 | struct sway_view *view = last_focus->sway_view; | 236 | struct sway_view *view = last_focus->sway_view; |
237 | view->iface.set_activated(view, false); | 237 | view_set_activated(view, false); |
238 | |||
239 | } | 238 | } |
240 | } | 239 | } |
241 | 240 | ||