- -- 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
- else
- min_fact = math.min(fact[i],min_fact)
- end
- total_fact = total_fact + fact[i]
- end
- size = math.min(size, available)
- local coord = wa[y]
- local geom = {}
- local used_size = 0
- local unused = wa[height]
- local stat_coord = wa[x]
- --stat_coord = size
- for c = group.first,group.last do
- local i = c - group.first +1
- geom[width] = size - (bw * 2)
- geom[height] = math.floor(unused * fact[i] / total_fact) - (bw * 2)
- geom[x] = group.coord
- geom[y] = coord
-
- coord = coord + geom[height] + 2 * bw
- unused = unused - geom[height] - 2 * bw
- total_fact = total_fact - fact[i]
- used_size = math.max(used_size, geom[width] + 2 * bw)
-
- -- Useless gap correction
- geom.width = geom.width - gap
- geom.height = geom.height - gap
-
- geom = cls[c]:geometry(geom)
- end
+local function swap(geometry)
+ return { x = geometry.y, y = geometry.x, width = geometry.height, height = geometry.width }
+end
+
+-- Find geometry for column/row tiling
+local function cut_area(wa, total, index, is_horizontal)
+ local wa = is_horizontal and swap(wa) or wa
+ local height = wa.height / total
+
+ local area = {
+ x = wa.x,
+ y = wa.y + (index - 1) * height,
+ width = wa.width,
+ height = height
+ }