mirror of
https://github.com/swaywm/sway.git
synced 2025-11-10 13:29:51 -05:00
Learn "gaps edge_gaps <on|off|toggle>".
When yes, the old behaviour of adding half the inner gap around each view is used. When no, don't add any gap when an edge of the view aligns with the workspace. The result is inner gap only between views, not against the workspace edge. The algorithm is not perfect because it means the extra space is distributed amongst edge-aligned views only, but it's simple, looks good and it works.
This commit is contained in:
parent
713c7d6e1e
commit
abc5fbfaec
5 changed files with 42 additions and 2 deletions
|
|
@ -367,9 +367,27 @@ void update_geometry(swayc_t *container) {
|
|||
if (op->focused == ws) {
|
||||
wlc_view_bring_to_front(container->handle);
|
||||
}
|
||||
} else if (!config->edge_gaps && gap > 0) {
|
||||
// Remove gap against the workspace edges. Because a pixel is not
|
||||
// divisable, depending on gap size and the number of siblings our view
|
||||
// might be at the workspace edge without being exactly so (thus test
|
||||
// with gap, and align correctly).
|
||||
if (container->x - gap <= ws->x) {
|
||||
geometry.origin.x = ws->x;
|
||||
geometry.size.w = container->width - gap/2;
|
||||
}
|
||||
if (container->y - gap <= ws->y) {
|
||||
geometry.origin.y = ws->y;
|
||||
geometry.size.h = container->height - gap/2;
|
||||
}
|
||||
if (container->x + container->width + gap >= ws->x + ws->width) {
|
||||
geometry.size.w = ws->width - geometry.origin.x;
|
||||
}
|
||||
if (container->y + container->height + gap >= ws->y + ws->height) {
|
||||
geometry.size.h = ws->height - geometry.origin.y;
|
||||
}
|
||||
}
|
||||
wlc_view_set_geometry(container->handle, 0, &geometry);
|
||||
return;
|
||||
}
|
||||
|
||||
static void arrange_windows_r(swayc_t *container, double width, double height) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue