wibox.hierarchy: Only count "really visible" widgets

Widgets with width or height zero cannot really be counted as visible,
so do not do so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-03-11 18:44:56 +01:00
parent 51e4a47938
commit 13dbc558fc
2 changed files with 4 additions and 3 deletions

View file

@ -157,8 +157,8 @@ function hierarchy_update(self, context, widget, width, height, region, matrix_t
-- Update widget counts
self._widget_counts = {}
if widgets_to_count[self._widget] then
self._widget_counts[self._widget] = 1
if widgets_to_count[widget] and width > 0 and height > 0 then
self._widget_counts[widget] = 1
end
for _, h in ipairs(self._children) do
for w, count in pairs(h._widget_counts) do

View file

@ -272,7 +272,8 @@ describe("wibox.hierarchy", function()
make_child(child, 10, 20, matrix.identity)
})
parent = make_widget({
make_child(intermediate, 10, 20, matrix.identity)
make_child(intermediate, 10, 20, matrix.identity),
make_child(child, 0, 20, matrix.identity)
})
unrelated = make_widget(nil)