diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index d4e853dee..4904c46b5 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -431,9 +431,10 @@ static void arrange_container(struct sway_container *con, int border_left = con->current.border_left ? border_width : 0; int border_right = con->current.border_right ? border_width : 0; int vert_border_height = MAX(0, height - border_top - border_bottom); + int horiz_border_width = MAX(0, width); - wlr_scene_rect_set_size(con->border.top, width, border_top); - wlr_scene_rect_set_size(con->border.bottom, width, border_bottom); + wlr_scene_rect_set_size(con->border.top, horiz_border_width, border_top); + wlr_scene_rect_set_size(con->border.bottom, horiz_border_width, border_bottom); wlr_scene_rect_set_size(con->border.left, border_left, vert_border_height); wlr_scene_rect_set_size(con->border.right, @@ -445,7 +446,7 @@ static void arrange_container(struct sway_container *con, wlr_scene_node_set_position(&con->border.left->node, 0, border_top); wlr_scene_node_set_position(&con->border.right->node, - width - border_right, border_top); + horiz_border_width - border_right, border_top); // make sure to reparent, it's possible that the client just came out of // fullscreen mode where the parent of the surface is not the container diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index c525b77a9..7f1022cbd 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -81,6 +81,12 @@ static void resize_box(struct wlr_box *box, enum wlr_edges edge, box->y += thickness; box->width -= thickness * 2; box->height -= thickness * 2; + if (box->width < 0) { + box->width = 0; + } + if (box->height < 0) { + box->height = 0; + } break; } } @@ -153,6 +159,12 @@ static bool split_titlebar(struct sway_node *node, struct sway_container *avoid, } static void update_indicator(struct seatop_move_tiling_event *e, struct wlr_box *box) { + if (box->width < 0) { + box->width = 0; + } + if (box->height < 0) { + box->height = 0; + } wlr_scene_node_set_position(&e->indicator_rect->node, box->x, box->y); wlr_scene_rect_set_size(e->indicator_rect, box->width, box->height); } diff --git a/sway/tree/container.c b/sway/tree/container.c index 6880841bd..01dca4b03 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -278,7 +278,15 @@ static void update_rect_list(struct wlr_scene_tree *tree, pixman_region32_t *reg if (i < len) { const pixman_box32_t *box = &rects[i++]; wlr_scene_node_set_position(&rect->node, box->x1, box->y1); - wlr_scene_rect_set_size(rect, box->x2 - box->x1, box->y2 - box->y1); + int rect_width = box->x2 - box->x1; + int rect_height = box->y2 - box->y1; + if (rect_width < 0) { + rect_width = 0; + } + if (rect_height < 0) { + rect_height = 0; + } + wlr_scene_rect_set_size(rect, rect_width, rect_height); } } }