From 87813a5597ae7e13e94ef866d63f5ba66beb7cc9 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 26 Mar 2016 01:40:59 -0400 Subject: [PATCH] layout.margin: Avoid unneeded redraw --- lib/wibox/layout/margin.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/wibox/layout/margin.lua b/lib/wibox/layout/margin.lua index 9a8a8b2c..0b94099c 100644 --- a/lib/wibox/layout/margin.lua +++ b/lib/wibox/layout/margin.lua @@ -87,6 +87,13 @@ end --- Set all the margins to val. function margin:set_margins(val) + if self.left == val and + self.right == val and + self.top == val and + self.bottom == val then + return + end + self.left = val self.right = val self.top = val @@ -142,6 +149,7 @@ end -- Create setters for each direction for _, v in pairs({ "left", "right", "top", "bottom" }) do margin["set_" .. v] = function(layout, val) + if layout[v] == val then return end layout[v] = val layout:emit_signal("widget::layout_changed") end