aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-06-11 21:41:02 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2019-06-12 07:56:41 +0300
commit9670ccee683ab985e89eb04302fb998c4161f2d6 (patch)
treef7cafeaf55a7c139e97a920b0b43bcb080d3a27c /sway/config.c
parentFix segfaults caused by faulty command parsing (diff)
downloadsway-9670ccee683ab985e89eb04302fb998c4161f2d6.tar.gz
sway-9670ccee683ab985e89eb04302fb998c4161f2d6.tar.zst
sway-9670ccee683ab985e89eb04302fb998c4161f2d6.zip
bindings: defer while initiailizing
This adds the logic to defer binding execution while sway is still initializing. Without this, the binding command would be executed, but the command handler would return CMD_DEFER, which was being treated as a failure to run. To avoid partial executions, this will defer all bindings while config->active is false.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index 4f92b403..4e64bd3a 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -644,7 +644,23 @@ void run_deferred_commands(void) {
644 list_free(res_list); 644 list_free(res_list);
645 free(line); 645 free(line);
646 } 646 }
647 transaction_commit_dirty(); 647}
648
649void run_deferred_bindings(void) {
650 struct sway_seat *seat;
651 wl_list_for_each(seat, &(server.input->seats), link) {
652 if (!seat->deferred_bindings->length) {
653 continue;
654 }
655 sway_log(SWAY_DEBUG, "Running deferred bindings for seat %s",
656 seat->wlr_seat->name);
657 while (seat->deferred_bindings->length) {
658 struct sway_binding *binding = seat->deferred_bindings->items[0];
659 seat_execute_command(seat, binding);
660 list_del(seat->deferred_bindings, 0);
661 free_sway_binding(binding);
662 }
663 }
648} 664}
649 665
650// get line, with backslash continuation 666// get line, with backslash continuation