- -- 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 - global_border))
- local coord = wa[y]
- local geom = {}
- local used_size = 0
- local unused = wa[height] - (global_border * 2)
- local stat_coord = wa[x]
- --stat_coord = size
- for c = group.first,group.last do
- local i = c - group.first +1
- geom[width] = size - global_border - (bw * 2)
- geom[height] = math.floor(unused * fact[i] / total_fact) - (bw * 2)
- geom[x] = group.coord + global_border
- geom[y] = coord + global_border
-
- coord = coord + geom[height]
- unused = unused - geom[height]
- total_fact = total_fact - fact[i]
- used_size = math.max(used_size, geom[width])
-
- -- Useless gap
- if useless_gap > 0
- then
- -- Top and left clients are shrinked by two steps and
- -- get moved away from the border. Other clients just
- -- get shrinked in one direction.
-
- top = false
- left = false
-
- if geom[y] == wa[y] then
- top = true
- end
-
- if geom[x] == 0 or geom[x] == wa[x] then
- left = true
- end
-
- if top then
- geom[height] = geom[height] - (2 * useless_gap)
- geom[y] = geom[y] + useless_gap
- else
- geom[height] = geom[height] - useless_gap
- end
-
- if left then
- geom[width] = geom[width] - (2 * useless_gap)
- geom[x] = geom[x] + useless_gap
- else
- geom[width] = geom[width] - useless_gap
- end
- end
- -- End of useless gap.