Merge pull request #3187 from PlayerNameHere/master

Fix wibox.layout.stack:raise() returning prematurely and inserting the widget at the end instead of the start
This commit is contained in:
Emmanuel Lepage Vallée 2020-09-28 23:32:06 -07:00 committed by GitHub
commit ed6cdf87b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -116,11 +116,11 @@ end
-- @method raise -- @method raise
-- @tparam number index the widget index to raise -- @tparam number index the widget index to raise
function stack:raise(index) 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] local w = self._private.widgets[index]
table.remove(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") self:emit_signal("widget::layout_changed")
end end
@ -170,8 +170,12 @@ end
function stack:set_horizontal_offset(value) function stack:set_horizontal_offset(value)
self._private.h_offset = value self._private.h_offset = value
self:emit_signal("widget::horizontal_offset") self:emit_signal("widget::layout_changed")
self:emit_signal("property::top_only", value) self:emit_signal("property::horizontal_offset", value)
end
function stack:get_horizontal_offset()
return self._private.h_offset
end end
function stack:set_vertical_offset(value) function stack:set_vertical_offset(value)
@ -180,6 +184,10 @@ function stack:set_vertical_offset(value)
self:emit_signal("property::vertical_offset", value) self:emit_signal("property::vertical_offset", value)
end end
function stack:get_vertical_offset()
return self._private.v_offset
end
--- Create a new stack layout. --- Create a new stack layout.
-- --
-- @constructorfct wibox.layout.stack -- @constructorfct wibox.layout.stack