- -- make this more generic (not just width)
- --if for top
- available = wa[width] - (group.coord - wa[x]) -- it's truly not here
-
- -- find our total values
- local total_fact = 0
- local min_fact = 1
- local size = group.size
- for c = group.first,group.last do
- -- determine the width/height based on the size_hint
- local i = c - group.first +1
- local size_hints = cls[c].size_hints
- local size_hint = size_hints["min_"..width] or size_hints["base_"..width] or 0
- size_hint = size_hint + cls[c].border_width*2
- size = math.max(size_hint, size)
-
- -- calculate the height
- if not fact[i] then
- fact[i] = min_fact
+-- Find geometry for secondary windows column
+local function cut_column(wa, n, index)
+ local width = math.floor(wa.width / n)
+ local area = { x = wa.x + (index - 1) * width, y = wa.y, width = width, height = wa.height }
+
+ return area
+end
+
+-- Find geometry for certain window in column
+local function cut_row(wa, factor, index, used)
+ local height = math.floor(wa.height * factor.window[index] / factor.total)
+ local area = { x = wa.x, y = wa.y + used, width = wa.width, height = height }
+
+ return area
+end
+
+-- Client geometry correction depending on useless gap and window border
+local function size_correction(c, geometry, useless_gap)
+ geometry.width = math.max(geometry.width - 2 * c.border_width - useless_gap, 1)
+ geometry.height = math.max(geometry.height - 2 * c.border_width - useless_gap, 1)
+ geometry.x = math.floor(geometry.x + useless_gap / 2)
+ geometry.y = math.floor(geometry.y + useless_gap / 2)
+end
+
+-- Check size factor for group of clients and calculate total
+local function calc_factor(n, winfactors)
+ local factor = { window = winfactors, total = 0, min = 1 }
+
+ for i = 1, n do
+ if not factor.window[i] then
+ factor.window[i] = factor.min