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 | a6bc46eea9d7dec6a2b93f85bac2e3737e0c6725 (diff) | |
parent | beb3805cf0300bc2640290233aa763d757c12466 (diff) |
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) { sway_seat_configure_xcursor(seat); } } + +struct sway_seat *sway_input_manager_get_default_seat( + struct sway_input_manager *input) { + struct sway_seat *seat = NULL; + wl_list_for_each(seat, &input->seats, link) { + if (strcmp(seat->wlr_seat->name, "seat0") == 0) { + return seat; + } + } + return seat; +} 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, return false; } -static void binding_execute_command(struct sway_binding *binding) { +static void keyboard_execute_command(struct sway_keyboard *keyboard, + struct sway_binding *binding) { wlr_log(L_DEBUG, "running command for binding: %s", binding->command); + config_clear_handler_context(config); + config->handler_context.seat = keyboard->seat_device->sway_seat; struct cmd_results *results = handle_command(binding->command); if (results->status != CMD_SUCCESS) { wlr_log(L_DEBUG, "could not run command for binding: %s", @@ -160,7 +163,7 @@ static bool keyboard_execute_bindsym(struct sway_keyboard *keyboard, } if (match) { - binding_execute_command(binding); + keyboard_execute_command(keyboard, binding); return true; } } @@ -267,7 +270,7 @@ static bool keyboard_execute_bindcode(struct sway_keyboard *keyboard, for (int i = 0; i < keycode_bindings->length; ++i) { struct sway_binding *binding = keycode_bindings->items[i]; if (binding_matches_keycodes(wlr_keyboard, binding, event)) { - binding_execute_command(binding); + keyboard_execute_command(keyboard, binding); return true; } } 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) { if (container) { struct sway_view *view = container->sway_view; - view->iface.set_activated(view, true); + view_set_activated(view, true); wl_signal_add(&container->events.destroy, &seat->focus_destroy); seat->focus_destroy.notify = handle_focus_destroy; @@ -234,8 +234,7 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { if (last_focus && !sway_input_manager_has_focus(seat->input, last_focus)) { struct sway_view *view = last_focus->sway_view; - view->iface.set_activated(view, false); - + view_set_activated(view, false); } } |