diff options
author | Simon Ser <contact@emersion.fr> | 2020-07-02 10:59:16 +0200 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2020-07-02 17:11:05 -0400 |
commit | 1bfbf262cc501db7bd94f651ea16aa4af607f548 (patch) | |
tree | 66e1cf7554d7f1c22c9bd50aa38b8909dbf660a1 /sway/input | |
parent | commands/move: unwrap workspace container on move to new workspace (diff) | |
download | sway-1bfbf262cc501db7bd94f651ea16aa4af607f548.tar.gz sway-1bfbf262cc501db7bd94f651ea16aa4af607f548.tar.zst sway-1bfbf262cc501db7bd94f651ea16aa4af607f548.zip |
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
Diffstat (limited to 'sway/input')
-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 a54bc2e7..1e987360 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -572,14 +572,6 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
572 | 572 | ||
573 | seat->deferred_bindings = create_list(); | 573 | seat->deferred_bindings = create_list(); |
574 | 574 | ||
575 | if (!wl_list_empty(&server.input->seats)) { | ||
576 | // Since this is not the first seat, attempt to set initial focus | ||
577 | struct sway_seat *current_seat = input_manager_current_seat(); | ||
578 | struct sway_node *current_focus = | ||
579 | seat_get_focus_inactive(current_seat, &root->node); | ||
580 | seat_set_focus(seat, current_focus); | ||
581 | } | ||
582 | |||
583 | wl_signal_add(&root->events.new_node, &seat->new_node); | 575 | wl_signal_add(&root->events.new_node, &seat->new_node); |
584 | seat->new_node.notify = handle_new_node; | 576 | seat->new_node.notify = handle_new_node; |
585 | 577 | ||
@@ -604,8 +596,17 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
604 | 596 | ||
605 | sway_input_method_relay_init(seat, &seat->im_relay); | 597 | sway_input_method_relay_init(seat, &seat->im_relay); |
606 | 598 | ||
599 | bool first = wl_list_empty(&server.input->seats); | ||
607 | wl_list_insert(&server.input->seats, &seat->link); | 600 | wl_list_insert(&server.input->seats, &seat->link); |
608 | 601 | ||
602 | if (!first) { | ||
603 | // Since this is not the first seat, attempt to set initial focus | ||
604 | struct sway_seat *current_seat = input_manager_current_seat(); | ||
605 | struct sway_node *current_focus = | ||
606 | seat_get_focus_inactive(current_seat, &root->node); | ||
607 | seat_set_focus(seat, current_focus); | ||
608 | } | ||
609 | |||
609 | seatop_begin_default(seat); | 610 | seatop_begin_default(seat); |
610 | 611 | ||
611 | return seat; | 612 | return seat; |