diff options
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 03ed638e..6dbd1900 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -184,8 +184,8 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) { | |||
184 | seat_set_focus(seat, next_focus); | 184 | seat_set_focus(seat, next_focus); |
185 | } else { | 185 | } else { |
186 | // Setting focus_inactive | 186 | // Setting focus_inactive |
187 | seat_set_focus_warp(seat, next_focus, false, false); | 187 | seat_set_raw_focus(seat, next_focus); |
188 | seat_set_focus_warp(seat, focus, false, false); | 188 | seat_set_raw_focus(seat, focus); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
@@ -623,8 +623,16 @@ static void container_raise_floating(struct sway_container *con) { | |||
623 | } | 623 | } |
624 | } | 624 | } |
625 | 625 | ||
626 | void seat_set_raw_focus(struct sway_seat *seat, struct sway_node *node) { | ||
627 | struct sway_seat_node *seat_node = seat_node_from_node(seat, node); | ||
628 | wl_list_remove(&seat_node->link); | ||
629 | wl_list_insert(&seat->focus_stack, &seat_node->link); | ||
630 | node_set_dirty(node); | ||
631 | node_set_dirty(node_get_parent(node)); | ||
632 | } | ||
633 | |||
626 | void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | 634 | void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, |
627 | bool warp, bool notify) { | 635 | bool warp) { |
628 | if (seat->focused_layer) { | 636 | if (seat->focused_layer) { |
629 | return; | 637 | return; |
630 | } | 638 | } |
@@ -688,32 +696,20 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
688 | if (container) { | 696 | if (container) { |
689 | struct sway_container *parent = container->parent; | 697 | struct sway_container *parent = container->parent; |
690 | while (parent) { | 698 | while (parent) { |
691 | struct sway_seat_node *seat_node = | 699 | seat_set_raw_focus(seat, &parent->node); |
692 | seat_node_from_node(seat, &parent->node); | ||
693 | wl_list_remove(&seat_node->link); | ||
694 | wl_list_insert(&seat->focus_stack, &seat_node->link); | ||
695 | node_set_dirty(&parent->node); | ||
696 | parent = parent->parent; | 700 | parent = parent->parent; |
697 | } | 701 | } |
698 | } | 702 | } |
699 | if (new_workspace) { | 703 | if (new_workspace) { |
700 | struct sway_seat_node *seat_node = | 704 | seat_set_raw_focus(seat, &new_workspace->node); |
701 | seat_node_from_node(seat, &new_workspace->node); | ||
702 | wl_list_remove(&seat_node->link); | ||
703 | wl_list_insert(&seat->focus_stack, &seat_node->link); | ||
704 | node_set_dirty(&new_workspace->node); | ||
705 | } | 705 | } |
706 | if (container) { | 706 | if (container) { |
707 | struct sway_seat_node *seat_node = | 707 | seat_set_raw_focus(seat, &container->node); |
708 | seat_node_from_node(seat, &container->node); | ||
709 | wl_list_remove(&seat_node->link); | ||
710 | wl_list_insert(&seat->focus_stack, &seat_node->link); | ||
711 | node_set_dirty(&container->node); | ||
712 | seat_send_focus(&container->node, seat); | 708 | seat_send_focus(&container->node, seat); |
713 | } | 709 | } |
714 | 710 | ||
715 | // emit ipc events | 711 | // emit ipc events |
716 | if (notify && new_workspace && last_workspace != new_workspace) { | 712 | if (new_workspace && last_workspace != new_workspace) { |
717 | ipc_event_workspace(last_workspace, new_workspace, "focus"); | 713 | ipc_event_workspace(last_workspace, new_workspace, "focus"); |
718 | } | 714 | } |
719 | if (container && container->view) { | 715 | if (container && container->view) { |
@@ -807,17 +803,17 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
807 | } | 803 | } |
808 | 804 | ||
809 | void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { | 805 | void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { |
810 | seat_set_focus_warp(seat, node, true, true); | 806 | seat_set_focus_warp(seat, node, true); |
811 | } | 807 | } |
812 | 808 | ||
813 | void seat_set_focus_container(struct sway_seat *seat, | 809 | void seat_set_focus_container(struct sway_seat *seat, |
814 | struct sway_container *con) { | 810 | struct sway_container *con) { |
815 | seat_set_focus_warp(seat, con ? &con->node : NULL, true, true); | 811 | seat_set_focus_warp(seat, con ? &con->node : NULL, true); |
816 | } | 812 | } |
817 | 813 | ||
818 | void seat_set_focus_workspace(struct sway_seat *seat, | 814 | void seat_set_focus_workspace(struct sway_seat *seat, |
819 | struct sway_workspace *ws) { | 815 | struct sway_workspace *ws) { |
820 | seat_set_focus_warp(seat, ws ? &ws->node : NULL, true, true); | 816 | seat_set_focus_warp(seat, ws ? &ws->node : NULL, true); |
821 | } | 817 | } |
822 | 818 | ||
823 | void seat_set_focus_surface(struct sway_seat *seat, | 819 | void seat_set_focus_surface(struct sway_seat *seat, |