From 13e41a2a7b0314486463e8e7ea671c55afe7b749 Mon Sep 17 00:00:00 2001 From: PlayerNameHere Date: Sat, 26 Sep 2020 23:49:44 +0800 Subject: [PATCH 1/3] Fix wibox.layout.stack:raise() There seem to be two issues here. First, the if-statement at the beginning of the function will return prematurely if `self._private.widgets[index]` exists. There seems to be a missing `not` there. Second, index 1 is interpreted as the top of the stack (although the documentation says otherwise), but the widget is inserted at the end of `self._private.widgets`, so it gets pushed to the bottom instead of the top. --- lib/wibox/layout/stack.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wibox/layout/stack.lua b/lib/wibox/layout/stack.lua index 3efaadec..4b5a9c5b 100644 --- a/lib/wibox/layout/stack.lua +++ b/lib/wibox/layout/stack.lua @@ -116,11 +116,11 @@ end -- @method raise -- @tparam number index the widget index to raise function stack:raise(index) - if (not index) or self._private.widgets[index] then return end + if (not index) or (not self._private.widgets[index]) then return end local w = self._private.widgets[index] table.remove(self._private.widgets, index) - table.insert(self._private.widgets, w) + table.insert(self._private.widgets, 1, w) self:emit_signal("widget::layout_changed") end From 2647e1c8558a6ec045a3b3a91dafc0b974e65e82 Mon Sep 17 00:00:00 2001 From: PlayerNameHere Date: Sun, 27 Sep 2020 23:58:22 +0800 Subject: [PATCH 2/3] Fix emitted signals in wibox.layout.stack:set_horizontal_offset() --- lib/wibox/layout/stack.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wibox/layout/stack.lua b/lib/wibox/layout/stack.lua index 4b5a9c5b..792e47b1 100644 --- a/lib/wibox/layout/stack.lua +++ b/lib/wibox/layout/stack.lua @@ -170,8 +170,8 @@ end function stack:set_horizontal_offset(value) self._private.h_offset = value - self:emit_signal("widget::horizontal_offset") - self:emit_signal("property::top_only", value) + self:emit_signal("widget::layout_changed") + self:emit_signal("property::horizontal_offset", value) end function stack:set_vertical_offset(value) From 45cfbe72bfd535ae532c1c12d7c342a0426c8b6d Mon Sep 17 00:00:00 2001 From: PlayerNameHere Date: Mon, 28 Sep 2020 00:00:08 +0800 Subject: [PATCH 3/3] Add getters for wibox.layout.stack offset properties Getters for the horizontal_offset and vertical_offset properties were missing, which resulted in nil when trying to get them. --- lib/wibox/layout/stack.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/wibox/layout/stack.lua b/lib/wibox/layout/stack.lua index 792e47b1..6f3cd92a 100644 --- a/lib/wibox/layout/stack.lua +++ b/lib/wibox/layout/stack.lua @@ -174,12 +174,20 @@ function stack:set_horizontal_offset(value) self:emit_signal("property::horizontal_offset", value) end +function stack:get_horizontal_offset() + return self._private.h_offset +end + function stack:set_vertical_offset(value) self._private.v_offset = value self:emit_signal("widget::layout_changed") self:emit_signal("property::vertical_offset", value) end +function stack:get_vertical_offset() + return self._private.v_offset +end + --- Create a new stack layout. -- -- @constructorfct wibox.layout.stack