aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-10-17 15:57:13 +0200
committerLibravatar GitHub <noreply@github.com>2018-10-17 15:57:13 +0200
commit765c80e5f7c36df77e9475a662648a0d87b93606 (patch)
tree21f28277ff5109d9f8ec196a12fc74bbb5dfd994 /sway/tree
parentMerge pull request #2862 from SpeedJack/fix-stringop-overflow (diff)
parentview: rewarp cursor during view_unmap (diff)
downloadsway-765c80e5f7c36df77e9475a662648a0d87b93606.tar.gz
sway-765c80e5f7c36df77e9475a662648a0d87b93606.tar.zst
sway-765c80e5f7c36df77e9475a662648a0d87b93606.zip
Merge pull request #2820 from Emantor/fix-mouse-warping-container
Fix mouse warping container
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/view.c37
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
547void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { 547void 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
607void view_unmap(struct sway_view *view) { 623void 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();