diff options
-rw-r--r-- | include/sway/tree/container.h | 11 | ||||
-rw-r--r-- | include/sway/tree/view.h | 5 | ||||
-rw-r--r-- | sway/commands/floating.c | 13 | ||||
-rw-r--r-- | sway/commands/move.c | 10 | ||||
-rw-r--r-- | sway/desktop/render.c | 2 | ||||
-rw-r--r-- | sway/input/cursor.c | 5 | ||||
-rw-r--r-- | sway/input/seat.c | 5 | ||||
-rw-r--r-- | sway/scratchpad.c | 7 | ||||
-rw-r--r-- | sway/tree/container.c | 82 | ||||
-rw-r--r-- | sway/tree/layout.c | 19 | ||||
-rw-r--r-- | sway/tree/view.c | 53 |
11 files changed, 126 insertions, 86 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index c584cd92..d91b3bf1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -297,6 +297,11 @@ void container_notify_subtree_changed(struct sway_container *container); | |||
297 | */ | 297 | */ |
298 | size_t container_titlebar_height(void); | 298 | size_t container_titlebar_height(void); |
299 | 299 | ||
300 | /** | ||
301 | * Resize and center the container in its workspace. | ||
302 | */ | ||
303 | void container_init_floating(struct sway_container *container); | ||
304 | |||
300 | void container_set_floating(struct sway_container *container, bool enable); | 305 | void container_set_floating(struct sway_container *container, bool enable); |
301 | 306 | ||
302 | void container_set_geometry_from_floating_view(struct sway_container *con); | 307 | void container_set_geometry_from_floating_view(struct sway_container *con); |
@@ -341,6 +346,12 @@ void container_end_mouse_operation(struct sway_container *container); | |||
341 | void container_set_fullscreen(struct sway_container *container, bool enable); | 346 | void container_set_fullscreen(struct sway_container *container, bool enable); |
342 | 347 | ||
343 | /** | 348 | /** |
349 | * Return true if the container is floating, or a child of a floating split | ||
350 | * container. | ||
351 | */ | ||
352 | bool container_is_floating_or_child(struct sway_container *container); | ||
353 | |||
354 | /** | ||
344 | * Return true if the container is fullscreen, or a child of a fullscreen split | 355 | * Return true if the container is fullscreen, or a child of a fullscreen split |
345 | * container. | 356 | * container. |
346 | */ | 357 | */ |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 7086314f..0152ed55 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -235,11 +235,6 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | |||
235 | int height); | 235 | int height); |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Center the view in its workspace and build the swayc decorations around it. | ||
239 | */ | ||
240 | void view_init_floating(struct sway_view *view); | ||
241 | |||
242 | /** | ||
243 | * Configure the view's position and size based on the swayc's position and | 238 | * Configure the view's position and size based on the swayc's position and |
244 | * size, taking borders into consideration. | 239 | * size, taking borders into consideration. |
245 | */ | 240 | */ |
diff --git a/sway/commands/floating.c b/sway/commands/floating.c index 6ab56c3b..b67e736f 100644 --- a/sway/commands/floating.c +++ b/sway/commands/floating.c | |||
@@ -17,9 +17,16 @@ struct cmd_results *cmd_floating(int argc, char **argv) { | |||
17 | } | 17 | } |
18 | struct sway_container *container = | 18 | struct sway_container *container = |
19 | config->handler_context.current_container; | 19 | config->handler_context.current_container; |
20 | if (container->type != C_VIEW) { | 20 | if (container->type == C_WORKSPACE && container->children->length == 0) { |
21 | // TODO: This doesn't strictly speaking have to be true | 21 | return cmd_results_new(CMD_INVALID, "floating", |
22 | return cmd_results_new(CMD_INVALID, "float", "Only views can float"); | 22 | "Can't float an empty workspace"); |
23 | } | ||
24 | if (container->type == C_WORKSPACE) { | ||
25 | // Wrap the workspace's children in a container so we can float it | ||
26 | struct sway_container *workspace = container; | ||
27 | container = container_wrap_children(container); | ||
28 | workspace->layout = L_HORIZ; | ||
29 | seat_set_focus(config->handler_context.seat, container); | ||
23 | } | 30 | } |
24 | 31 | ||
25 | bool wants_floating; | 32 | bool wants_floating; |
diff --git a/sway/commands/move.c b/sway/commands/move.c index aede3d6c..b127c89f 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -298,9 +298,15 @@ static struct cmd_results *move_to_position(struct sway_container *container, | |||
298 | } | 298 | } |
299 | 299 | ||
300 | static struct cmd_results *move_to_scratchpad(struct sway_container *con) { | 300 | static struct cmd_results *move_to_scratchpad(struct sway_container *con) { |
301 | if (con->type != C_CONTAINER && con->type != C_VIEW) { | 301 | if (con->type == C_WORKSPACE && con->children->length == 0) { |
302 | return cmd_results_new(CMD_INVALID, "move", | 302 | return cmd_results_new(CMD_INVALID, "move", |
303 | "Only views and containers can be moved to the scratchpad"); | 303 | "Can't move an empty workspace to the scratchpad"); |
304 | } | ||
305 | if (con->type == C_WORKSPACE) { | ||
306 | // Wrap the workspace's children in a container | ||
307 | struct sway_container *workspace = con; | ||
308 | con = container_wrap_children(con); | ||
309 | workspace->layout = L_HORIZ; | ||
304 | } | 310 | } |
305 | if (con->scratchpad) { | 311 | if (con->scratchpad) { |
306 | return cmd_results_new(CMD_INVALID, "move", | 312 | return cmd_results_new(CMD_INVALID, "move", |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index d2f1c9f2..c9fdfd95 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -779,7 +779,7 @@ static void render_floating_container(struct sway_output *soutput, | |||
779 | } | 779 | } |
780 | render_view(soutput, damage, con, colors); | 780 | render_view(soutput, damage, con, colors); |
781 | } else { | 781 | } else { |
782 | render_container(soutput, damage, con, false); | 782 | render_container(soutput, damage, con, con->current.focused); |
783 | } | 783 | } |
784 | } | 784 | } |
785 | 785 | ||
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index cc0dbe99..d1347198 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -598,7 +598,10 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
598 | seat_set_focus_layer(cursor->seat, layer); | 598 | seat_set_focus_layer(cursor->seat, layer); |
599 | } | 599 | } |
600 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); | 600 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); |
601 | } else if (cont && container_is_floating(cont)) { | 601 | } else if (cont && container_is_floating_or_child(cont)) { |
602 | while (cont->parent->layout != L_FLOATING) { | ||
603 | cont = cont->parent; | ||
604 | } | ||
602 | dispatch_cursor_button_floating(cursor, time_msec, button, state, | 605 | dispatch_cursor_button_floating(cursor, time_msec, button, state, |
603 | surface, sx, sy, cont); | 606 | surface, sx, sy, cont); |
604 | } else if (surface && cont && cont->type != C_VIEW) { | 607 | } else if (surface && cont && cont->type != C_VIEW) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index e7b6e0c5..877a93c6 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -184,7 +184,6 @@ static void handle_seat_container_destroy(struct wl_listener *listener, | |||
184 | bool set_focus = | 184 | bool set_focus = |
185 | focus != NULL && | 185 | focus != NULL && |
186 | (focus == con || container_has_child(con, focus)) && | 186 | (focus == con || container_has_child(con, focus)) && |
187 | con->parent && con->parent->children->length > 1 && | ||
188 | con->type != C_WORKSPACE; | 187 | con->type != C_WORKSPACE; |
189 | 188 | ||
190 | seat_container_destroy(seat_con); | 189 | seat_container_destroy(seat_con); |
@@ -754,10 +753,6 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
754 | } | 753 | } |
755 | } | 754 | } |
756 | 755 | ||
757 | if (last_focus != NULL) { | ||
758 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
759 | } | ||
760 | |||
761 | seat->has_focus = (container != NULL); | 756 | seat->has_focus = (container != NULL); |
762 | 757 | ||
763 | update_debug_tree(); | 758 | update_debug_tree(); |
diff --git a/sway/scratchpad.c b/sway/scratchpad.c index 64636c77..181d9b3b 100644 --- a/sway/scratchpad.c +++ b/sway/scratchpad.c | |||
@@ -72,11 +72,7 @@ static void scratchpad_show(struct sway_container *con) { | |||
72 | if (!wlr_box_contains_point(&workspace_box, center_lx, center_ly)) { | 72 | if (!wlr_box_contains_point(&workspace_box, center_lx, center_ly)) { |
73 | // Maybe resize it | 73 | // Maybe resize it |
74 | if (con->width > ws->width || con->height > ws->height) { | 74 | if (con->width > ws->width || con->height > ws->height) { |
75 | // TODO: Do this properly once we can float C_CONTAINERs | 75 | container_init_floating(con); |
76 | if (con->type == C_VIEW) { | ||
77 | view_init_floating(con->sway_view); | ||
78 | arrange_windows(con); | ||
79 | } | ||
80 | } | 76 | } |
81 | 77 | ||
82 | // Center it | 78 | // Center it |
@@ -85,6 +81,7 @@ static void scratchpad_show(struct sway_container *con) { | |||
85 | container_floating_move_to(con, new_lx, new_ly); | 81 | container_floating_move_to(con, new_lx, new_ly); |
86 | } | 82 | } |
87 | 83 | ||
84 | arrange_windows(ws); | ||
88 | seat_set_focus(seat, con); | 85 | seat_set_focus(seat, con); |
89 | 86 | ||
90 | container_set_dirty(con->parent); | 87 | container_set_dirty(con->parent); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 6ebf2653..566432b1 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -407,6 +407,10 @@ struct sway_container *container_flatten(struct sway_container *container) { | |||
407 | * This function just wraps container_destroy_noreaping(), then does reaping. | 407 | * This function just wraps container_destroy_noreaping(), then does reaping. |
408 | */ | 408 | */ |
409 | struct sway_container *container_destroy(struct sway_container *con) { | 409 | struct sway_container *container_destroy(struct sway_container *con) { |
410 | if (con->is_fullscreen) { | ||
411 | struct sway_container *ws = container_parent(con, C_WORKSPACE); | ||
412 | ws->sway_workspace->fullscreen = NULL; | ||
413 | } | ||
410 | struct sway_container *parent = container_destroy_noreaping(con); | 414 | struct sway_container *parent = container_destroy_noreaping(con); |
411 | 415 | ||
412 | if (!parent) { | 416 | if (!parent) { |
@@ -945,23 +949,81 @@ size_t container_titlebar_height() { | |||
945 | return config->font_height + TITLEBAR_V_PADDING * 2; | 949 | return config->font_height + TITLEBAR_V_PADDING * 2; |
946 | } | 950 | } |
947 | 951 | ||
952 | void container_init_floating(struct sway_container *con) { | ||
953 | if (!sway_assert(con->type == C_VIEW || con->type == C_CONTAINER, | ||
954 | "Expected a view or container")) { | ||
955 | return; | ||
956 | } | ||
957 | struct sway_container *ws = container_parent(con, C_WORKSPACE); | ||
958 | int min_width, min_height; | ||
959 | int max_width, max_height; | ||
960 | |||
961 | if (config->floating_minimum_width == -1) { // no minimum | ||
962 | min_width = 0; | ||
963 | } else if (config->floating_minimum_width == 0) { // automatic | ||
964 | min_width = 75; | ||
965 | } else { | ||
966 | min_width = config->floating_minimum_width; | ||
967 | } | ||
968 | |||
969 | if (config->floating_minimum_height == -1) { // no minimum | ||
970 | min_height = 0; | ||
971 | } else if (config->floating_minimum_height == 0) { // automatic | ||
972 | min_height = 50; | ||
973 | } else { | ||
974 | min_height = config->floating_minimum_height; | ||
975 | } | ||
976 | |||
977 | if (config->floating_maximum_width == -1) { // no maximum | ||
978 | max_width = INT_MAX; | ||
979 | } else if (config->floating_maximum_width == 0) { // automatic | ||
980 | max_width = ws->width * 0.6666; | ||
981 | } else { | ||
982 | max_width = config->floating_maximum_width; | ||
983 | } | ||
984 | |||
985 | if (config->floating_maximum_height == -1) { // no maximum | ||
986 | max_height = INT_MAX; | ||
987 | } else if (config->floating_maximum_height == 0) { // automatic | ||
988 | max_height = ws->height * 0.6666; | ||
989 | } else { | ||
990 | max_height = config->floating_maximum_height; | ||
991 | } | ||
992 | |||
993 | if (con->type == C_CONTAINER) { | ||
994 | con->width = max_width; | ||
995 | con->height = max_height; | ||
996 | con->x = ws->x + (ws->width - con->width) / 2; | ||
997 | con->y = ws->y + (ws->height - con->height) / 2; | ||
998 | } else { | ||
999 | struct sway_view *view = con->sway_view; | ||
1000 | view->width = fmax(min_width, fmin(view->natural_width, max_width)); | ||
1001 | view->height = fmax(min_height, fmin(view->natural_height, max_height)); | ||
1002 | view->x = ws->x + (ws->width - view->width) / 2; | ||
1003 | view->y = ws->y + (ws->height - view->height) / 2; | ||
1004 | |||
1005 | // If the view's border is B_NONE then these properties are ignored. | ||
1006 | view->border_top = view->border_bottom = true; | ||
1007 | view->border_left = view->border_right = true; | ||
1008 | |||
1009 | container_set_geometry_from_floating_view(view->swayc); | ||
1010 | } | ||
1011 | } | ||
1012 | |||
948 | void container_set_floating(struct sway_container *container, bool enable) { | 1013 | void container_set_floating(struct sway_container *container, bool enable) { |
949 | if (container_is_floating(container) == enable) { | 1014 | if (container_is_floating(container) == enable) { |
950 | return; | 1015 | return; |
951 | } | 1016 | } |
952 | 1017 | ||
953 | struct sway_container *workspace = container_parent(container, C_WORKSPACE); | 1018 | struct sway_container *workspace = container_parent(container, C_WORKSPACE); |
954 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
955 | 1019 | ||
956 | if (enable) { | 1020 | if (enable) { |
957 | container_remove_child(container); | 1021 | container_remove_child(container); |
958 | container_add_child(workspace->sway_workspace->floating, container); | 1022 | container_add_child(workspace->sway_workspace->floating, container); |
1023 | container_init_floating(container); | ||
959 | if (container->type == C_VIEW) { | 1024 | if (container->type == C_VIEW) { |
960 | view_init_floating(container->sway_view); | ||
961 | view_set_tiled(container->sway_view, false); | 1025 | view_set_tiled(container->sway_view, false); |
962 | } | 1026 | } |
963 | seat_set_focus(seat, seat_get_focus_inactive(seat, container)); | ||
964 | container_reap_empty_recursive(workspace); | ||
965 | } else { | 1027 | } else { |
966 | // Returning to tiled | 1028 | // Returning to tiled |
967 | if (container->scratchpad) { | 1029 | if (container->scratchpad) { |
@@ -975,7 +1037,6 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
975 | view_set_tiled(container->sway_view, true); | 1037 | view_set_tiled(container->sway_view, true); |
976 | } | 1038 | } |
977 | container->is_sticky = false; | 1039 | container->is_sticky = false; |
978 | container_reap_empty_recursive(workspace->sway_workspace->floating); | ||
979 | } | 1040 | } |
980 | 1041 | ||
981 | container_end_mouse_operation(container); | 1042 | container_end_mouse_operation(container); |
@@ -1195,6 +1256,17 @@ void container_set_fullscreen(struct sway_container *container, bool enable) { | |||
1195 | ipc_event_window(container, "fullscreen_mode"); | 1256 | ipc_event_window(container, "fullscreen_mode"); |
1196 | } | 1257 | } |
1197 | 1258 | ||
1259 | bool container_is_floating_or_child(struct sway_container *container) { | ||
1260 | do { | ||
1261 | if (container->parent && container->parent->layout == L_FLOATING) { | ||
1262 | return true; | ||
1263 | } | ||
1264 | container = container->parent; | ||
1265 | } while (container && container->type != C_WORKSPACE); | ||
1266 | |||
1267 | return false; | ||
1268 | } | ||
1269 | |||
1198 | bool container_is_fullscreen_or_child(struct sway_container *container) { | 1270 | bool container_is_fullscreen_or_child(struct sway_container *container) { |
1199 | do { | 1271 | do { |
1200 | if (container->is_fullscreen) { | 1272 | if (container->is_fullscreen) { |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index ab5acc16..a0764a54 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -387,9 +387,11 @@ void container_move(struct sway_container *container, | |||
387 | // If moving a fullscreen view, only consider outputs | 387 | // If moving a fullscreen view, only consider outputs |
388 | if (container->is_fullscreen) { | 388 | if (container->is_fullscreen) { |
389 | current = container_parent(container, C_OUTPUT); | 389 | current = container_parent(container, C_OUTPUT); |
390 | } else if (container_is_fullscreen_or_child(container)) { | 390 | } else if (container_is_fullscreen_or_child(container) || |
391 | container_is_floating_or_child(container)) { | ||
391 | // If we've fullscreened a split container, only allow the child to move | 392 | // If we've fullscreened a split container, only allow the child to move |
392 | // around within the fullscreen parent. | 393 | // around within the fullscreen parent. |
394 | // Same with floating a split container. | ||
393 | struct sway_container *ws = container_parent(container, C_WORKSPACE); | 395 | struct sway_container *ws = container_parent(container, C_WORKSPACE); |
394 | top = ws->sway_workspace->fullscreen; | 396 | top = ws->sway_workspace->fullscreen; |
395 | } | 397 | } |
@@ -465,6 +467,9 @@ void container_move(struct sway_container *container, | |||
465 | if ((index == parent->children->length - 1 && offs > 0) | 467 | if ((index == parent->children->length - 1 && offs > 0) |
466 | || (index == 0 && offs < 0)) { | 468 | || (index == 0 && offs < 0)) { |
467 | if (current->parent == container->parent) { | 469 | if (current->parent == container->parent) { |
470 | if (parent->parent->layout == L_FLOATING) { | ||
471 | return; | ||
472 | } | ||
468 | if (!parent->is_fullscreen && | 473 | if (!parent->is_fullscreen && |
469 | (parent->layout == L_TABBED || | 474 | (parent->layout == L_TABBED || |
470 | parent->layout == L_STACKED)) { | 475 | parent->layout == L_STACKED)) { |
@@ -488,10 +493,14 @@ void container_move(struct sway_container *container, | |||
488 | sibling = parent->children->items[index + offs]; | 493 | sibling = parent->children->items[index + offs]; |
489 | wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id); | 494 | wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id); |
490 | } | 495 | } |
491 | } else if (!parent->is_fullscreen && (parent->layout == L_TABBED || | 496 | } else if (!parent->is_fullscreen && |
497 | parent->parent->layout != L_FLOATING && | ||
498 | (parent->layout == L_TABBED || | ||
492 | parent->layout == L_STACKED)) { | 499 | parent->layout == L_STACKED)) { |
493 | move_out_of_tabs_stacks(container, current, move_dir, offs); | 500 | move_out_of_tabs_stacks(container, current, move_dir, offs); |
494 | return; | 501 | return; |
502 | } else if (parent->parent->layout == L_FLOATING) { | ||
503 | return; | ||
495 | } else { | 504 | } else { |
496 | wlr_log(WLR_DEBUG, "Moving up to find a parallel container"); | 505 | wlr_log(WLR_DEBUG, "Moving up to find a parallel container"); |
497 | current = current->parent; | 506 | current = current->parent; |
@@ -717,10 +726,6 @@ struct sway_container *container_get_in_direction( | |||
717 | enum movement_direction dir) { | 726 | enum movement_direction dir) { |
718 | struct sway_container *parent = container->parent; | 727 | struct sway_container *parent = container->parent; |
719 | 728 | ||
720 | if (container_is_floating(container)) { | ||
721 | return NULL; | ||
722 | } | ||
723 | |||
724 | if (dir == MOVE_CHILD) { | 729 | if (dir == MOVE_CHILD) { |
725 | return seat_get_focus_inactive(seat, container); | 730 | return seat_get_focus_inactive(seat, container); |
726 | } | 731 | } |
@@ -732,7 +737,7 @@ struct sway_container *container_get_in_direction( | |||
732 | parent = container->parent; | 737 | parent = container->parent; |
733 | } else { | 738 | } else { |
734 | if (dir == MOVE_PARENT) { | 739 | if (dir == MOVE_PARENT) { |
735 | if (parent->type == C_OUTPUT) { | 740 | if (parent->type == C_OUTPUT || container_is_floating(container)) { |
736 | return NULL; | 741 | return NULL; |
737 | } else { | 742 | } else { |
738 | return parent; | 743 | return parent; |
diff --git a/sway/tree/view.c b/sway/tree/view.c index e641544e..253f3001 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -168,55 +168,6 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | |||
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | 170 | ||
171 | void view_init_floating(struct sway_view *view) { | ||
172 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | ||
173 | int min_width, min_height; | ||
174 | int max_width, max_height; | ||
175 | |||
176 | if (config->floating_minimum_width == -1) { // no minimum | ||
177 | min_width = 0; | ||
178 | } else if (config->floating_minimum_width == 0) { // automatic | ||
179 | min_width = 75; | ||
180 | } else { | ||
181 | min_width = config->floating_minimum_width; | ||
182 | } | ||
183 | |||
184 | if (config->floating_minimum_height == -1) { // no minimum | ||
185 | min_height = 0; | ||
186 | } else if (config->floating_minimum_height == 0) { // automatic | ||
187 | min_height = 50; | ||
188 | } else { | ||
189 | min_height = config->floating_minimum_height; | ||
190 | } | ||
191 | |||
192 | if (config->floating_maximum_width == -1) { // no maximum | ||
193 | max_width = INT_MAX; | ||
194 | } else if (config->floating_maximum_width == 0) { // automatic | ||
195 | max_width = ws->width * 0.6666; | ||
196 | } else { | ||
197 | max_width = config->floating_maximum_width; | ||
198 | } | ||
199 | |||
200 | if (config->floating_maximum_height == -1) { // no maximum | ||
201 | max_height = INT_MAX; | ||
202 | } else if (config->floating_maximum_height == 0) { // automatic | ||
203 | max_height = ws->height * 0.6666; | ||
204 | } else { | ||
205 | max_height = config->floating_maximum_height; | ||
206 | } | ||
207 | |||
208 | view->width = fmax(min_width, fmin(view->natural_width, max_width)); | ||
209 | view->height = fmax(min_height, fmin(view->natural_height, max_height)); | ||
210 | view->x = ws->x + (ws->width - view->width) / 2; | ||
211 | view->y = ws->y + (ws->height - view->height) / 2; | ||
212 | |||
213 | // If the view's border is B_NONE then these properties are ignored. | ||
214 | view->border_top = view->border_bottom = true; | ||
215 | view->border_left = view->border_right = true; | ||
216 | |||
217 | container_set_geometry_from_floating_view(view->swayc); | ||
218 | } | ||
219 | |||
220 | void view_autoconfigure(struct sway_view *view) { | 171 | void view_autoconfigure(struct sway_view *view) { |
221 | if (!sway_assert(view->swayc, | 172 | if (!sway_assert(view->swayc, |
222 | "Called view_autoconfigure() on a view without a swayc")) { | 173 | "Called view_autoconfigure() on a view without a swayc")) { |
@@ -626,10 +577,8 @@ void view_unmap(struct sway_view *view) { | |||
626 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 577 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
627 | 578 | ||
628 | struct sway_container *parent; | 579 | struct sway_container *parent; |
629 | if (view->swayc->is_fullscreen) { | 580 | if (container_is_fullscreen_or_child(view->swayc)) { |
630 | ws->sway_workspace->fullscreen = NULL; | ||
631 | parent = container_destroy(view->swayc); | 581 | parent = container_destroy(view->swayc); |
632 | |||
633 | arrange_windows(ws->parent); | 582 | arrange_windows(ws->parent); |
634 | } else { | 583 | } else { |
635 | parent = container_destroy(view->swayc); | 584 | parent = container_destroy(view->swayc); |