| @@ -19,13 +19,15 @@ pub fn dwindle(monitor: *Monitor) void { |
| 19 |
} |
19 |
} |
| 20 |
if (n == 0) return; |
20 |
if (n == 0) return; |
| 21 |
|
21 |
|
| 22 |
- const gap_h = if (monitor.smartgaps_enabled and n == 1) 0 else monitor.gap_outer_h; |
22 |
+ const gap_outer_h = if (monitor.smartgaps_enabled and n == 1) 0 else monitor.gap_outer_h; |
| 23 |
- const gap_v = if (monitor.smartgaps_enabled and n == 1) 0 else monitor.gap_outer_v; |
23 |
+ const gap_outer_v = if (monitor.smartgaps_enabled and n == 1) 0 else monitor.gap_outer_v; |
|
|
24 |
+ const gap_inner_h = monitor.gap_inner_h; |
|
|
25 |
+ const gap_inner_v = monitor.gap_inner_v; |
| 24 |
|
26 |
|
| 25 |
- const work_x: i32 = monitor.win_x + gap_v; |
27 |
+ const work_x: i32 = monitor.win_x + gap_outer_v; |
| 26 |
- const work_y: i32 = monitor.win_y + gap_h; |
28 |
+ const work_y: i32 = monitor.win_y + gap_outer_h; |
| 27 |
- const work_w: i32 = monitor.win_w - 2 * gap_v; |
29 |
+ const work_w: i32 = monitor.win_w - 2 * gap_outer_v; |
| 28 |
- const work_h: i32 = monitor.win_h - 2 * gap_h; |
30 |
+ const work_h: i32 = monitor.win_h - 2 * gap_outer_h; |
| 29 |
|
31 |
|
| 30 |
var nx: i32 = work_x; |
32 |
var nx: i32 = work_x; |
| 31 |
var ny: i32 = 0; |
33 |
var ny: i32 = 0; |
| @@ -42,25 +44,25 @@ pub fn dwindle(monitor: *Monitor) void { |
| 42 |
if (can_split) { |
44 |
if (can_split) { |
| 43 |
if (i + 1 < n) { |
45 |
if (i + 1 < n) { |
| 44 |
if (i % 2 == 1) { |
46 |
if (i % 2 == 1) { |
| 45 |
- nh = @divTrunc(nh, 2); |
47 |
+ nh = @divTrunc(nh - gap_inner_h, 2); |
| 46 |
} else { |
48 |
} else { |
| 47 |
- nw = @divTrunc(nw, 2); |
49 |
+ nw = @divTrunc(nw - gap_inner_v, 2); |
| 48 |
} |
50 |
} |
| 49 |
} |
51 |
} |
| 50 |
switch (i % 4) { |
52 |
switch (i % 4) { |
| 51 |
- 0 => ny += nh, |
53 |
+ 0 => ny += nh + gap_inner_h, |
| 52 |
- 1 => nx += nw, |
54 |
+ 1 => nx += nw + gap_inner_v, |
| 53 |
- 2 => ny += nh, |
55 |
+ 2 => ny += nh + gap_inner_h, |
| 54 |
- 3 => nx += nw, |
56 |
+ 3 => nx += nw + gap_inner_v, |
| 55 |
else => unreachable, |
57 |
else => unreachable, |
| 56 |
} |
58 |
} |
| 57 |
if (i == 0) { |
59 |
if (i == 0) { |
| 58 |
if (n != 1) { |
60 |
if (n != 1) { |
| 59 |
- nw = @intFromFloat(@as(f32, @floatFromInt(work_w)) * monitor.mfact); |
61 |
+ nw = @intFromFloat(@as(f32, @floatFromInt(work_w - gap_inner_v)) * monitor.mfact); |
| 60 |
} |
62 |
} |
| 61 |
ny = work_y; |
63 |
ny = work_y; |
| 62 |
} else if (i == 1) { |
64 |
} else if (i == 1) { |
| 63 |
- nw = work_w - nw; |
65 |
+ nw = work_w - nw - gap_inner_v; |
| 64 |
} |
66 |
} |
| 65 |
i += 1; |
67 |
i += 1; |
| 66 |
} |
68 |
} |