From 0183372ac292621943b2df6094b5db977c7ee553 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 5 Oct 2016 19:56:56 +0200 Subject: [PATCH] wibox.drawable: Do not relayout while invisible Similar to the previous commit, this makes the drawable not apply a pending relayout while it is not visible. When it becomes visible again, the relayout is done. The hope here is that less work is done while a drawable is not visible, saving CPU time. Signed-off-by: Uli Schlachter --- lib/wibox/drawable.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/wibox/drawable.lua b/lib/wibox/drawable.lua index d2e10e9f8..a74c5d7da 100644 --- a/lib/wibox/drawable.lua +++ b/lib/wibox/drawable.lua @@ -429,7 +429,11 @@ function drawable.new(d, widget_context_skeleton, drawable_name) return end ret._need_relayout = true - ret:draw() + -- When not visible, we will be redrawn when we become visible. In the + -- mean-time, the layout does not matter much. + if ret._visible then + ret:draw() + end end -- Add __tostring method to metatable.