diff options
-rw-r--r-- | include/sway/tree/workspace.h | 4 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 11 | ||||
-rw-r--r-- | sway/input/seatop_move_tiling.c | 2 | ||||
-rw-r--r-- | sway/sway.5.scd | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 7 | ||||
-rw-r--r-- | sway/tree/output.c | 3 | ||||
-rw-r--r-- | sway/tree/view.c | 23 | ||||
-rw-r--r-- | sway/tree/workspace.c | 34 |
8 files changed, 51 insertions, 35 deletions
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index fe200ec0..3c9f93ed 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -110,13 +110,13 @@ void workspace_unwrap_children(struct sway_workspace *ws, | |||
110 | 110 | ||
111 | void workspace_detach(struct sway_workspace *workspace); | 111 | void workspace_detach(struct sway_workspace *workspace); |
112 | 112 | ||
113 | void workspace_add_tiling(struct sway_workspace *workspace, | 113 | struct sway_container *workspace_add_tiling(struct sway_workspace *workspace, |
114 | struct sway_container *con); | 114 | struct sway_container *con); |
115 | 115 | ||
116 | void workspace_add_floating(struct sway_workspace *workspace, | 116 | void workspace_add_floating(struct sway_workspace *workspace, |
117 | struct sway_container *con); | 117 | struct sway_container *con); |
118 | 118 | ||
119 | void workspace_insert_tiling(struct sway_workspace *workspace, | 119 | struct sway_container *workspace_insert_tiling(struct sway_workspace *workspace, |
120 | struct sway_container *con, int index); | 120 | struct sway_container *con, int index); |
121 | 121 | ||
122 | void workspace_remove_gaps(struct sway_workspace *ws); | 122 | void workspace_remove_gaps(struct sway_workspace *ws); |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index f02021e1..fdac6171 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -349,19 +349,20 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
349 | return; | 349 | return; |
350 | } | 350 | } |
351 | 351 | ||
352 | struct sway_container *container = view->container; | ||
352 | if (e->fullscreen && e->output && e->output->data) { | 353 | if (e->fullscreen && e->output && e->output->data) { |
353 | struct sway_output *output = e->output->data; | 354 | struct sway_output *output = e->output->data; |
354 | struct sway_workspace *ws = output_get_active_workspace(output); | 355 | struct sway_workspace *ws = output_get_active_workspace(output); |
355 | if (ws && !container_is_scratchpad_hidden(view->container)) { | 356 | if (ws && !container_is_scratchpad_hidden(container)) { |
356 | if (container_is_floating(view->container)) { | 357 | if (container_is_floating(container)) { |
357 | workspace_add_floating(ws, view->container); | 358 | workspace_add_floating(ws, container); |
358 | } else { | 359 | } else { |
359 | workspace_add_tiling(ws, view->container); | 360 | container = workspace_add_tiling(ws, container); |
360 | } | 361 | } |
361 | } | 362 | } |
362 | } | 363 | } |
363 | 364 | ||
364 | container_set_fullscreen(view->container, e->fullscreen); | 365 | container_set_fullscreen(container, e->fullscreen); |
365 | 366 | ||
366 | arrange_root(); | 367 | arrange_root(); |
367 | transaction_commit_dirty(); | 368 | transaction_commit_dirty(); |
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index c7285bec..704e7270 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c | |||
@@ -247,7 +247,7 @@ static void finalize_move(struct sway_seat *seat) { | |||
247 | 247 | ||
248 | // Moving container into empty workspace | 248 | // Moving container into empty workspace |
249 | if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) { | 249 | if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) { |
250 | workspace_add_tiling(new_ws, con); | 250 | con = workspace_add_tiling(new_ws, con); |
251 | } else if (target_node->type == N_CONTAINER) { | 251 | } else if (target_node->type == N_CONTAINER) { |
252 | // Moving container before/after another | 252 | // Moving container before/after another |
253 | struct sway_container *target = target_node->sway_container; | 253 | struct sway_container *target = target_node->sway_container; |
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index f608ad2e..02592b5f 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -89,7 +89,7 @@ The following commands may only be used in the configuration file. | |||
89 | _swaynag\_command -_ | 89 | _swaynag\_command -_ |
90 | 90 | ||
91 | *workspace_layout* default|stacking|tabbed | 91 | *workspace_layout* default|stacking|tabbed |
92 | Specifies the initial layout for new workspaces. | 92 | Specifies the initial layout for new containers in an empty workspace. |
93 | 93 | ||
94 | *xwayland* enable|disable|force | 94 | *xwayland* enable|disable|force |
95 | Enables or disables Xwayland support, which allows X11 applications to be | 95 | Enables or disables Xwayland support, which allows X11 applications to be |
diff --git a/sway/tree/container.c b/sway/tree/container.c index b0d23700..23b6c997 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -804,9 +804,10 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
804 | container->width = reference->width; | 804 | container->width = reference->width; |
805 | container->height = reference->height; | 805 | container->height = reference->height; |
806 | } else { | 806 | } else { |
807 | workspace_add_tiling(workspace, container); | 807 | struct sway_container *other = |
808 | container->width = workspace->width; | 808 | workspace_add_tiling(workspace, container); |
809 | container->height = workspace->height; | 809 | other->width = workspace->width; |
810 | other->height = workspace->height; | ||
810 | } | 811 | } |
811 | if (container->view) { | 812 | if (container->view) { |
812 | view_set_tiled(container->view, true); | 813 | view_set_tiled(container->view, true); |
diff --git a/sway/tree/output.c b/sway/tree/output.c index f15a84b3..a8ae30f7 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -395,9 +395,6 @@ void output_get_box(struct sway_output *output, struct wlr_box *box) { | |||
395 | 395 | ||
396 | enum sway_container_layout output_get_default_layout( | 396 | enum sway_container_layout output_get_default_layout( |
397 | struct sway_output *output) { | 397 | struct sway_output *output) { |
398 | if (config->default_layout != L_NONE) { | ||
399 | return config->default_layout; | ||
400 | } | ||
401 | if (config->default_orientation != L_NONE) { | 398 | if (config->default_orientation != L_NONE) { |
402 | return config->default_orientation; | 399 | return config->default_orientation; |
403 | } | 400 | } |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 354f2d34..e690c334 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -732,10 +732,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
732 | ws = seat_get_last_known_workspace(seat); | 732 | ws = seat_get_last_known_workspace(seat); |
733 | } | 733 | } |
734 | 734 | ||
735 | struct sway_container *container = view->container; | ||
735 | if (target_sibling) { | 736 | if (target_sibling) { |
736 | container_add_sibling(target_sibling, view->container, 1); | 737 | container_add_sibling(target_sibling, container, 1); |
737 | } else if (ws) { | 738 | } else if (ws) { |
738 | workspace_add_tiling(ws, view->container); | 739 | container = workspace_add_tiling(ws, container); |
739 | } | 740 | } |
740 | ipc_event_window(view->container, "new"); | 741 | ipc_event_window(view->container, "new"); |
741 | 742 | ||
@@ -759,26 +760,26 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
759 | } | 760 | } |
760 | 761 | ||
761 | if (config->popup_during_fullscreen == POPUP_LEAVE && | 762 | if (config->popup_during_fullscreen == POPUP_LEAVE && |
762 | view->container->workspace && | 763 | container->workspace && |
763 | view->container->workspace->fullscreen && | 764 | container->workspace->fullscreen && |
764 | view->container->workspace->fullscreen->view) { | 765 | container->workspace->fullscreen->view) { |
765 | struct sway_container *fs = view->container->workspace->fullscreen; | 766 | struct sway_container *fs = container->workspace->fullscreen; |
766 | if (view_is_transient_for(view, fs->view)) { | 767 | if (view_is_transient_for(view, fs->view)) { |
767 | container_set_fullscreen(fs, false); | 768 | container_set_fullscreen(fs, false); |
768 | } | 769 | } |
769 | } | 770 | } |
770 | 771 | ||
771 | view_update_title(view, false); | 772 | view_update_title(view, false); |
772 | container_update_representation(view->container); | 773 | container_update_representation(container); |
773 | 774 | ||
774 | if (fullscreen) { | 775 | if (fullscreen) { |
775 | container_set_fullscreen(view->container, true); | 776 | container_set_fullscreen(view->container, true); |
776 | arrange_workspace(view->container->workspace); | 777 | arrange_workspace(view->container->workspace); |
777 | } else { | 778 | } else { |
778 | if (view->container->parent) { | 779 | if (container->parent) { |
779 | arrange_container(view->container->parent); | 780 | arrange_container(container->parent); |
780 | } else if (view->container->workspace) { | 781 | } else if (container->workspace) { |
781 | arrange_workspace(view->container->workspace); | 782 | arrange_workspace(container->workspace); |
782 | } | 783 | } |
783 | } | 784 | } |
784 | 785 | ||
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index ffcbe933..e40792ae 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -627,6 +627,21 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws, | |||
627 | return NULL; | 627 | return NULL; |
628 | } | 628 | } |
629 | 629 | ||
630 | static void set_workspace(struct sway_container *container, void *data) { | ||
631 | container->workspace = container->parent->workspace; | ||
632 | } | ||
633 | |||
634 | static void workspace_attach_tiling(struct sway_workspace *ws, | ||
635 | struct sway_container *con) { | ||
636 | list_add(ws->tiling, con); | ||
637 | con->workspace = ws; | ||
638 | container_for_each_child(con, set_workspace, NULL); | ||
639 | container_handle_fullscreen_reparent(con); | ||
640 | workspace_update_representation(ws); | ||
641 | node_set_dirty(&ws->node); | ||
642 | node_set_dirty(&con->node); | ||
643 | } | ||
644 | |||
630 | struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { | 645 | struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { |
631 | struct sway_container *fs = ws->fullscreen; | 646 | struct sway_container *fs = ws->fullscreen; |
632 | struct sway_container *middle = container_create(NULL); | 647 | struct sway_container *middle = container_create(NULL); |
@@ -636,7 +651,7 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { | |||
636 | container_detach(child); | 651 | container_detach(child); |
637 | container_add_child(middle, child); | 652 | container_add_child(middle, child); |
638 | } | 653 | } |
639 | workspace_add_tiling(ws, middle); | 654 | workspace_attach_tiling(ws, middle); |
640 | ws->fullscreen = fs; | 655 | ws->fullscreen = fs; |
641 | return middle; | 656 | return middle; |
642 | } | 657 | } |
@@ -668,15 +683,14 @@ void workspace_detach(struct sway_workspace *workspace) { | |||
668 | node_set_dirty(&output->node); | 683 | node_set_dirty(&output->node); |
669 | } | 684 | } |
670 | 685 | ||
671 | static void set_workspace(struct sway_container *container, void *data) { | 686 | struct sway_container *workspace_add_tiling(struct sway_workspace *workspace, |
672 | container->workspace = container->parent->workspace; | ||
673 | } | ||
674 | |||
675 | void workspace_add_tiling(struct sway_workspace *workspace, | ||
676 | struct sway_container *con) { | 687 | struct sway_container *con) { |
677 | if (con->workspace) { | 688 | if (con->workspace) { |
678 | container_detach(con); | 689 | container_detach(con); |
679 | } | 690 | } |
691 | if (config->default_layout != L_NONE) { | ||
692 | con = container_split(con, config->default_layout); | ||
693 | } | ||
680 | list_add(workspace->tiling, con); | 694 | list_add(workspace->tiling, con); |
681 | con->workspace = workspace; | 695 | con->workspace = workspace; |
682 | container_for_each_child(con, set_workspace, NULL); | 696 | container_for_each_child(con, set_workspace, NULL); |
@@ -684,6 +698,7 @@ void workspace_add_tiling(struct sway_workspace *workspace, | |||
684 | workspace_update_representation(workspace); | 698 | workspace_update_representation(workspace); |
685 | node_set_dirty(&workspace->node); | 699 | node_set_dirty(&workspace->node); |
686 | node_set_dirty(&con->node); | 700 | node_set_dirty(&con->node); |
701 | return con; | ||
687 | } | 702 | } |
688 | 703 | ||
689 | void workspace_add_floating(struct sway_workspace *workspace, | 704 | void workspace_add_floating(struct sway_workspace *workspace, |
@@ -699,13 +714,13 @@ void workspace_add_floating(struct sway_workspace *workspace, | |||
699 | node_set_dirty(&con->node); | 714 | node_set_dirty(&con->node); |
700 | } | 715 | } |
701 | 716 | ||
702 | void workspace_insert_tiling(struct sway_workspace *workspace, | 717 | struct sway_container *workspace_insert_tiling(struct sway_workspace *workspace, |
703 | struct sway_container *con, int index) { | 718 | struct sway_container *con, int index) { |
704 | if (con->workspace) { | 719 | if (con->workspace) { |
705 | container_detach(con); | 720 | container_detach(con); |
706 | } | 721 | } |
707 | if (workspace->layout == L_STACKED || workspace->layout == L_TABBED) { | 722 | if (config->default_layout != L_NONE) { |
708 | con = container_split(con, workspace->layout); | 723 | con = container_split(con, config->default_layout); |
709 | } | 724 | } |
710 | list_insert(workspace->tiling, index, con); | 725 | list_insert(workspace->tiling, index, con); |
711 | con->workspace = workspace; | 726 | con->workspace = workspace; |
@@ -714,6 +729,7 @@ void workspace_insert_tiling(struct sway_workspace *workspace, | |||
714 | workspace_update_representation(workspace); | 729 | workspace_update_representation(workspace); |
715 | node_set_dirty(&workspace->node); | 730 | node_set_dirty(&workspace->node); |
716 | node_set_dirty(&con->node); | 731 | node_set_dirty(&con->node); |
732 | return con; | ||
717 | } | 733 | } |
718 | 734 | ||
719 | void workspace_add_gaps(struct sway_workspace *ws) { | 735 | void workspace_add_gaps(struct sway_workspace *ws) { |