|
|
@ -706,6 +706,25 @@ void workspace_add_gaps(struct sway_workspace *ws) {
|
|
|
|
ws->current_gaps.bottom = fmax(0, ws->current_gaps.bottom + ws->gaps_inner);
|
|
|
|
ws->current_gaps.bottom = fmax(0, ws->current_gaps.bottom + ws->gaps_inner);
|
|
|
|
ws->current_gaps.left = fmax(0, ws->current_gaps.left + ws->gaps_inner);
|
|
|
|
ws->current_gaps.left = fmax(0, ws->current_gaps.left + ws->gaps_inner);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now that we have the total gaps calculated we may need to clamp them in
|
|
|
|
|
|
|
|
// case they've made the available area too small
|
|
|
|
|
|
|
|
if (ws->width - ws->current_gaps.left - ws->current_gaps.right < MIN_SANE_W
|
|
|
|
|
|
|
|
&& ws->current_gaps.left + ws->current_gaps.right > 0) {
|
|
|
|
|
|
|
|
int total_gap = fmax(0, ws->width - MIN_SANE_W);
|
|
|
|
|
|
|
|
double left_gap_frac = ((double)ws->current_gaps.left /
|
|
|
|
|
|
|
|
((double)ws->current_gaps.left + (double)ws->current_gaps.right));
|
|
|
|
|
|
|
|
ws->current_gaps.left = left_gap_frac * total_gap;
|
|
|
|
|
|
|
|
ws->current_gaps.right = total_gap - ws->current_gaps.left;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ws->height - ws->current_gaps.top - ws->current_gaps.bottom < MIN_SANE_H
|
|
|
|
|
|
|
|
&& ws->current_gaps.top + ws->current_gaps.bottom > 0) {
|
|
|
|
|
|
|
|
int total_gap = fmax(0, ws->height - MIN_SANE_H);
|
|
|
|
|
|
|
|
double top_gap_frac = ((double) ws->current_gaps.top /
|
|
|
|
|
|
|
|
((double)ws->current_gaps.top + (double)ws->current_gaps.bottom));
|
|
|
|
|
|
|
|
ws->current_gaps.top = top_gap_frac * total_gap;
|
|
|
|
|
|
|
|
ws->current_gaps.bottom = total_gap - ws->current_gaps.top;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ws->x += ws->current_gaps.left;
|
|
|
|
ws->x += ws->current_gaps.left;
|
|
|
|
ws->y += ws->current_gaps.top;
|
|
|
|
ws->y += ws->current_gaps.top;
|
|
|
|
ws->width -= ws->current_gaps.left + ws->current_gaps.right;
|
|
|
|
ws->width -= ws->current_gaps.left + ws->current_gaps.right;
|
|
|
|