From 13dbc558fc10daba3a32f69ab9cfb2bd94413121 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 11 Mar 2017 18:44:56 +0100 Subject: [PATCH] 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 --- lib/wibox/hierarchy.lua | 4 ++-- spec/wibox/hierarchy_spec.lua | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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)