simplified view_autoconfigure

This commit is contained in:
William McKinnon 2026-03-01 16:11:37 -05:00
parent c74dba8c45
commit 0fea4ba92e

View file

@ -367,36 +367,26 @@ void view_autoconfigure(struct sway_view *view) {
} }
} }
double x, y, width, height; double x = con->pending.x;
switch (con->pending.border) { double y = con->pending.y;
default: double width = con->pending.width;
case B_CSD: double height = con->pending.height;
case B_NONE:
x = con->pending.x; if (con->pending.border == B_PIXEL) {
y = con->pending.y; x += con->pending.border_thickness * con->pending.border_left;
width = con->pending.width; y += con->pending.border_thickness * con->pending.border_top;
height = con->pending.height; width -= con->pending.border_thickness * con->pending.border_left
break; + con->pending.border_thickness * con->pending.border_right;
case B_PIXEL: height -= con->pending.border_thickness * con->pending.border_top
x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
y = con->pending.y + con->pending.border_thickness * con->pending.border_top;
width = con->pending.width
- con->pending.border_thickness * con->pending.border_left
- con->pending.border_thickness * con->pending.border_right;
height = con->pending.height
- con->pending.border_thickness * con->pending.border_top
- con->pending.border_thickness * con->pending.border_bottom; - con->pending.border_thickness * con->pending.border_bottom;
break; } else if (con->pending.border == B_NORMAL) {
case B_NORMAL:
// Height is: 1px border + 3px pad + title height + 3px pad + 1px border // Height is: 1px border + 3px pad + title height + 3px pad + 1px border
x = con->pending.x + con->pending.border_thickness * con->pending.border_left; x += con->pending.border_thickness * con->pending.border_left;
y = con->pending.y + container_titlebar_height(); y += container_titlebar_height();
width = con->pending.width width -= con->pending.border_thickness * con->pending.border_left
- con->pending.border_thickness * con->pending.border_left + con->pending.border_thickness * con->pending.border_right;
- con->pending.border_thickness * con->pending.border_right; height -= container_titlebar_height()
height = con->pending.height - container_titlebar_height() + con->pending.border_thickness * con->pending.border_bottom;
- con->pending.border_thickness * con->pending.border_bottom;
break;
} }
con->pending.content_x = x; con->pending.content_x = x;