From a58ac33afb1d83fc418589909ec7ad71fa7b8ceb Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 9 Aug 2016 16:20:35 -0400 Subject: [PATCH] smart_wibox: Do not call set_position when the area reamin the same. This is a band-aid on top of deeper issues when layout_changed is wrongly called. This should prevent menus moving in random places when the mouse is moved. Note that this commit wont stop them from moving when their size really change. This is harder to fix as all the "outside of the workarea" checks still need to be performed and in many cases, such as async loaded menus, the move itself is really necessary while in others it is unwanted. --- smart_wibox.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smart_wibox.lua b/smart_wibox.lua index 9bf47c4..551c918 100644 --- a/smart_wibox.lua +++ b/smart_wibox.lua @@ -71,9 +71,13 @@ function main_widget:layout(context, width, height) if self.widget then local w, h = wibox.widget.base.fit_widget(self, context, self.widget, 9999, 9999) glib.idle_add(glib.PRIORITY_HIGH_IDLE, function() + local prev_geo = self._wb:geometry() self._wb.width = math.ceil(w or 1) self._wb.height = math.ceil(h or 1) - set_position(self._wb) + + if self._wb.width ~= prev_geo.width and self._wb.height ~= prev_geo.height then + set_position(self._wb) + end end) return { wibox.widget.base.place_widget_at(self.widget, 0, 0, width, height) } end