diff options
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/view.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 1104af36..85998547 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -544,7 +544,8 @@ static bool should_focus(struct sway_view *view) { | |||
544 | return len == 0; | 544 | return len == 0; |
545 | } | 545 | } |
546 | 546 | ||
547 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | 547 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, |
548 | bool fullscreen, bool decoration) { | ||
548 | if (!sway_assert(view->surface == NULL, "cannot map mapped view")) { | 549 | if (!sway_assert(view->surface == NULL, "cannot map mapped view")) { |
549 | return; | 550 | return; |
550 | } | 551 | } |
@@ -595,13 +596,28 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
595 | } | 596 | } |
596 | } | 597 | } |
597 | 598 | ||
598 | if (should_focus(view)) { | ||
599 | input_manager_set_focus(input_manager, &view->container->node); | ||
600 | } | ||
601 | |||
602 | view_update_title(view, false); | 599 | view_update_title(view, false); |
603 | container_update_representation(view->container); | 600 | container_update_representation(view->container); |
604 | view_execute_criteria(view); | 601 | view_execute_criteria(view); |
602 | |||
603 | if (decoration) { | ||
604 | view_update_csd_from_client(view, decoration); | ||
605 | } | ||
606 | |||
607 | if (fullscreen) { | ||
608 | container_set_fullscreen(view->container, true); | ||
609 | arrange_workspace(view->container->workspace); | ||
610 | } else { | ||
611 | if (view->container->parent) { | ||
612 | arrange_container(view->container->parent); | ||
613 | } else if (view->container->workspace) { | ||
614 | arrange_workspace(view->container->workspace); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | if (should_focus(view)) { | ||
619 | input_manager_set_focus(input_manager, &view->container->node); | ||
620 | } | ||
605 | } | 621 | } |
606 | 622 | ||
607 | void view_unmap(struct sway_view *view) { | 623 | void view_unmap(struct sway_view *view) { |
@@ -630,7 +646,16 @@ void view_unmap(struct sway_view *view) { | |||
630 | 646 | ||
631 | struct sway_seat *seat; | 647 | struct sway_seat *seat; |
632 | wl_list_for_each(seat, &input_manager->seats, link) { | 648 | wl_list_for_each(seat, &input_manager->seats, link) { |
633 | cursor_send_pointer_motion(seat->cursor, 0, true); | 649 | if (config->mouse_warping == WARP_CONTAINER) { |
650 | struct sway_node *node = seat_get_focus(seat); | ||
651 | if (node && node->type == N_CONTAINER) { | ||
652 | cursor_warp_to_container(seat->cursor, node->sway_container); | ||
653 | } else if (node && node->type == N_WORKSPACE) { | ||
654 | cursor_warp_to_workspace(seat->cursor, node->sway_workspace); | ||
655 | } | ||
656 | } else { | ||
657 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
658 | } | ||
634 | } | 659 | } |
635 | 660 | ||
636 | transaction_commit_dirty(); | 661 | transaction_commit_dirty(); |