mirror of
https://github.com/swaywm/sway.git
synced 2026-04-02 07:15:50 -04:00
Rework gaps code to be simpler and correct
Instead of tracking gaps per child apply gaps in two logical places: 1. In tiled containers use the layout code to add the gaps between windows. This is much simpler and guarantees that the sizing of children is correct. 2. In the workspace itself apply all the gaps around the edge. Here we're in the correct position to size inner and outer gaps correctly and decide on smart gaps in a single location. Fixes #4296
This commit is contained in:
parent
2dc4978d8a
commit
d0233af3b3
6 changed files with 53 additions and 136 deletions
|
|
@ -183,14 +183,6 @@ bool view_is_only_visible(struct sway_view *view) {
|
|||
}
|
||||
|
||||
static bool gaps_to_edge(struct sway_view *view) {
|
||||
struct sway_container *con = view->container;
|
||||
while (con) {
|
||||
if (con->current_gaps.top > 0 || con->current_gaps.right > 0 ||
|
||||
con->current_gaps.bottom > 0 || con->current_gaps.left > 0) {
|
||||
return true;
|
||||
}
|
||||
con = con->parent;
|
||||
}
|
||||
struct side_gaps gaps = view->container->workspace->current_gaps;
|
||||
return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
|
||||
}
|
||||
|
|
@ -232,14 +224,14 @@ void view_autoconfigure(struct sway_view *view) {
|
|||
|
||||
if (config->hide_edge_borders == E_BOTH
|
||||
|| config->hide_edge_borders == E_VERTICAL || hide_smart) {
|
||||
con->border_left = con->x - con->current_gaps.left != ws->x;
|
||||
int right_x = con->x + con->width + con->current_gaps.right;
|
||||
con->border_left = con->x != ws->x;
|
||||
int right_x = con->x + con->width;
|
||||
con->border_right = right_x != ws->x + ws->width;
|
||||
}
|
||||
if (config->hide_edge_borders == E_BOTH
|
||||
|| config->hide_edge_borders == E_HORIZONTAL || hide_smart) {
|
||||
con->border_top = con->y - con->current_gaps.top != ws->y;
|
||||
int bottom_y = con->y + con->height + con->current_gaps.bottom;
|
||||
con->border_top = con->y != ws->y;
|
||||
int bottom_y = con->y + con->height;
|
||||
con->border_bottom = bottom_y != ws->y + ws->height;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue