diff options
author | Simon Ser <contact@emersion.fr> | 2020-07-02 10:59:16 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-15 19:22:39 +0200 |
commit | 70cc5236ecb0651f042e9dc6d8eb0c0844ef8583 (patch) | |
tree | c400de85ea1c0a34706e69c68bfc6547be226da1 | |
parent | 472dce662116bb13101e27ecb4b05b803ee21e64 (diff) |
seat: fix segfault in sway_input_method_relay_set_focus
sway_input_method_relay_set_focus was called before
sway_input_method_relay_init.
Closes: https://github.com/swaywm/sway/issues/5503
(cherry picked from commit 1bfbf262cc501db7bd94f651ea16aa4af607f548)
-rw-r--r-- | sway/input/seat.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index a54bc2e7d..1e9873604 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -572,14 +572,6 @@ struct sway_seat *seat_create(const char *seat_name) { seat->deferred_bindings = create_list(); - if (!wl_list_empty(&server.input->seats)) { - // Since this is not the first seat, attempt to set initial focus - struct sway_seat *current_seat = input_manager_current_seat(); - struct sway_node *current_focus = - seat_get_focus_inactive(current_seat, &root->node); - seat_set_focus(seat, current_focus); - } - wl_signal_add(&root->events.new_node, &seat->new_node); seat->new_node.notify = handle_new_node; @@ -604,8 +596,17 @@ struct sway_seat *seat_create(const char *seat_name) { sway_input_method_relay_init(seat, &seat->im_relay); + bool first = wl_list_empty(&server.input->seats); wl_list_insert(&server.input->seats, &seat->link); + if (!first) { + // Since this is not the first seat, attempt to set initial focus + struct sway_seat *current_seat = input_manager_current_seat(); + struct sway_node *current_focus = + seat_get_focus_inactive(current_seat, &root->node); + seat_set_focus(seat, current_focus); + } + seatop_begin_default(seat); return seat; |