diff --git a/lib/wibox/hierarchy.lua b/lib/wibox/hierarchy.lua index 6875eca83..e0da295ce 100644 --- a/lib/wibox/hierarchy.lua +++ b/lib/wibox/hierarchy.lua @@ -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 diff --git a/spec/wibox/hierarchy_spec.lua b/spec/wibox/hierarchy_spec.lua index 7c64ecee2..6882a7426 100644 --- a/spec/wibox/hierarchy_spec.lua +++ b/spec/wibox/hierarchy_spec.lua @@ -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)