aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 068dbb88..10aed599 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1173,72 +1173,6 @@ void container_discover_outputs(struct sway_container *con) {
1173 } 1173 }
1174} 1174}
1175 1175
1176void container_remove_gaps(struct sway_container *c) {
1177 if (c->current_gaps.top == 0 && c->current_gaps.right == 0 &&
1178 c->current_gaps.bottom == 0 && c->current_gaps.left == 0) {
1179 return;
1180 }
1181
1182 c->width += c->current_gaps.left + c->current_gaps.right;
1183 c->height += c->current_gaps.top + c->current_gaps.bottom;
1184 c->x -= c->current_gaps.left;
1185 c->y -= c->current_gaps.top;
1186
1187 c->current_gaps.top = 0;
1188 c->current_gaps.right = 0;
1189 c->current_gaps.bottom = 0;
1190 c->current_gaps.left = 0;
1191}
1192
1193void container_add_gaps(struct sway_container *c) {
1194 if (c->current_gaps.top > 0 || c->current_gaps.right > 0 ||
1195 c->current_gaps.bottom > 0 || c->current_gaps.left > 0) {
1196 return;
1197 }
1198 // Fullscreen global scratchpad containers cannot have gaps
1199 struct sway_workspace *ws = c->workspace;
1200 if (!ws) {
1201 return;
1202 }
1203 // Linear containers don't have gaps because it'd create double gaps
1204 if (!c->view && c->layout != L_TABBED && c->layout != L_STACKED) {
1205 return;
1206 }
1207 // Descendants of tabbed/stacked containers re-use the gaps of the container
1208 struct sway_container *temp = c;
1209 while (temp) {
1210 enum sway_container_layout layout = container_parent_layout(temp);
1211 if (layout == L_TABBED || layout == L_STACKED) {
1212 return;
1213 }
1214 temp = temp->parent;
1215 }
1216 // If smart gaps is on, don't add gaps if there is only one view visible
1217 if (config->smart_gaps) {
1218 struct sway_view *view = c->view;
1219 if (!view) {
1220 struct sway_seat *seat =
1221 input_manager_get_default_seat();
1222 struct sway_container *focus =
1223 seat_get_focus_inactive_view(seat, &c->node);
1224 view = focus ? focus->view : NULL;
1225 }
1226 if (view && view_is_only_visible(view)) {
1227 return;
1228 }
1229 }
1230
1231 c->current_gaps.top = c->y == ws->y ? ws->gaps_inner : 0;
1232 c->current_gaps.right = ws->gaps_inner;
1233 c->current_gaps.bottom = ws->gaps_inner;
1234 c->current_gaps.left = c->x == ws->x ? ws->gaps_inner : 0;
1235
1236 c->x += c->current_gaps.left;
1237 c->y += c->current_gaps.top;
1238 c->width -= c->current_gaps.left + c->current_gaps.right;
1239 c->height -= c->current_gaps.top + c->current_gaps.bottom;
1240}
1241
1242enum sway_container_layout container_parent_layout(struct sway_container *con) { 1176enum sway_container_layout container_parent_layout(struct sway_container *con) {
1243 if (con->parent) { 1177 if (con->parent) {
1244 return con->parent->layout; 1178 return con->parent->layout;
@@ -1421,7 +1355,6 @@ struct sway_container *container_split(struct sway_container *child,
1421 cont->height_fraction = child->height_fraction; 1355 cont->height_fraction = child->height_fraction;
1422 cont->x = child->x; 1356 cont->x = child->x;
1423 cont->y = child->y; 1357 cont->y = child->y;
1424 cont->current_gaps = child->current_gaps;
1425 cont->layout = layout; 1358 cont->layout = layout;
1426 1359
1427 container_replace(child, cont); 1360 container_replace(child, cont);