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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-10-05 19:56:56 +02:00
parent 9b51779f2f
commit 0183372ac2
1 changed files with 5 additions and 1 deletions

View File

@ -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.