layoutlist: Fix the `layout` consturctor parameter.

If set, it would override some important widget methods and
explode.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-24 21:45:09 -07:00
parent 2f8413acbc
commit 440d1560a3
1 changed files with 11 additions and 7 deletions

View File

@ -314,10 +314,10 @@ function layoutlist:set_base_layout(layout)
layout or wibox.layout.fixed.horizontal layout or wibox.layout.fixed.horizontal
) )
if self._private.layout.set_spacing then local spacing = self._private.style.spacing or beautiful.tasklist_spacing
self._private.layout:set_spacing(
self._private.style.spacing or beautiful.layoutlist_spacing or 0 if self._private.layout.set_spacing and spacing then
) self._private.layout:set_spacing(spacing)
end end
assert(self._private.layout.is_widget) assert(self._private.layout.is_widget)
@ -415,11 +415,15 @@ local function new(_, args)
reload_cache(ret) reload_cache(ret)
-- Apply all args properties -- Apply all args properties. Make sure "set_layout" doesn't override
gtable.crush(ret, args) -- the widget `layout` method.
local l = args.layout
args.layout = nil
gtable.crush(ret, args, false)
args.layout = l
if not ret._private.layout then if not ret._private.layout then
ret:set_base_layout() ret:set_base_layout(args.layout)
end end
assert(ret._private.layout) assert(ret._private.layout)