aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.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/input/seat.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/input/seat.c')
-rw-r--r--sway/input/seat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index e6b53736..12309c1d 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -9,6 +9,7 @@
9#include <wlr/types/wlr_primary_selection.h> 9#include <wlr/types/wlr_primary_selection.h>
10#include <wlr/types/wlr_xcursor_manager.h> 10#include <wlr/types/wlr_xcursor_manager.h>
11#include "config.h" 11#include "config.h"
12#include "list.h"
12#include "log.h" 13#include "log.h"
13#include "sway/desktop.h" 14#include "sway/desktop.h"
14#include "sway/input/cursor.h" 15#include "sway/input/cursor.h"
@@ -51,6 +52,10 @@ void seat_destroy(struct sway_seat *seat) {
51 wl_list_remove(&seat->request_set_primary_selection.link); 52 wl_list_remove(&seat->request_set_primary_selection.link);
52 wl_list_remove(&seat->link); 53 wl_list_remove(&seat->link);
53 wlr_seat_destroy(seat->wlr_seat); 54 wlr_seat_destroy(seat->wlr_seat);
55 for (int i = 0; i < seat->deferred_bindings->length; i++) {
56 free_sway_binding(seat->deferred_bindings->items[i]);
57 }
58 list_free(seat->deferred_bindings);
54 free(seat->prev_workspace_name); 59 free(seat->prev_workspace_name);
55 free(seat); 60 free(seat);
56} 61}
@@ -445,6 +450,8 @@ struct sway_seat *seat_create(const char *seat_name) {
445 root_for_each_workspace(collect_focus_workspace_iter, seat); 450 root_for_each_workspace(collect_focus_workspace_iter, seat);
446 root_for_each_container(collect_focus_container_iter, seat); 451 root_for_each_container(collect_focus_container_iter, seat);
447 452
453 seat->deferred_bindings = create_list();
454
448 if (!wl_list_empty(&server.input->seats)) { 455 if (!wl_list_empty(&server.input->seats)) {
449 // Since this is not the first seat, attempt to set initial focus 456 // Since this is not the first seat, attempt to set initial focus
450 struct sway_seat *current_seat = input_manager_current_seat(); 457 struct sway_seat *current_seat = input_manager_current_seat();