mirror of
https://github.com/swaywm/sway.git
synced 2025-11-22 06:59:48 -05:00
Merge pull request #2726 from RyanDwyer/overhaul-gaps
Make gaps implementation consistent with i3-gaps
This commit is contained in:
commit
f1dbdce0b2
9 changed files with 234 additions and 181 deletions
|
|
@ -1029,7 +1029,7 @@ void container_add_gaps(struct sway_container *c) {
|
|||
|
||||
struct sway_workspace *ws = c->workspace;
|
||||
|
||||
c->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
|
||||
c->current_gaps = ws->gaps_inner;
|
||||
c->x += c->current_gaps;
|
||||
c->y += c->current_gaps;
|
||||
c->width -= 2 * c->current_gaps;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,20 @@ struct sway_workspace *workspace_create(struct sway_output *output,
|
|||
ws->output_priority = create_list();
|
||||
workspace_output_add_priority(ws, output);
|
||||
|
||||
ws->gaps_outer = config->gaps_outer;
|
||||
ws->gaps_inner = config->gaps_inner;
|
||||
if (name) {
|
||||
struct workspace_config *wsc = workspace_find_config(name);
|
||||
if (wsc) {
|
||||
if (wsc->gaps_outer != -1) {
|
||||
ws->gaps_outer = wsc->gaps_outer;
|
||||
}
|
||||
if (wsc->gaps_inner != -1) {
|
||||
ws->gaps_inner = wsc->gaps_inner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output_add_workspace(output, ws);
|
||||
output_sort_workspaces(output);
|
||||
|
||||
|
|
@ -632,13 +646,13 @@ void workspace_add_gaps(struct sway_workspace *ws) {
|
|||
return;
|
||||
}
|
||||
|
||||
ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer;
|
||||
ws->current_gaps = ws->gaps_outer;
|
||||
|
||||
if (ws->layout == L_TABBED || ws->layout == L_STACKED) {
|
||||
// We have to add inner gaps for this, because children of tabbed and
|
||||
// stacked containers don't apply their own gaps - they assume the
|
||||
// tabbed/stacked container is using gaps.
|
||||
ws->current_gaps += ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
|
||||
ws->current_gaps += ws->gaps_inner;
|
||||
}
|
||||
|
||||
ws->x += ws->current_gaps;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue