drawin: Add a get_wibox function
As wibox contain a drawin, but isn't one, it is necessary to map drawin to wibox. This could eventually be fixed by turning wibox into drawin just like the client, tag and screen do.
This commit is contained in:
parent
5404b3c374
commit
baf290a8b2
|
@ -299,6 +299,13 @@ local function new(args)
|
||||||
local ret = object()
|
local ret = object()
|
||||||
local w = capi.drawin(args)
|
local w = capi.drawin(args)
|
||||||
|
|
||||||
|
-- lua 5.1 and luajit have issues with self referencing loops
|
||||||
|
local avoid_leak = setmetatable({ret},{__mode="v"})
|
||||||
|
|
||||||
|
function w.get_wibox()
|
||||||
|
return avoid_leak[1]
|
||||||
|
end
|
||||||
|
|
||||||
ret.drawin = w
|
ret.drawin = w
|
||||||
ret._drawable = wibox.drawable(w.drawable, { wibox = ret },
|
ret._drawable = wibox.drawable(w.drawable, { wibox = ret },
|
||||||
"wibox drawable (" .. object.modulename(3) .. ")")
|
"wibox drawable (" .. object.modulename(3) .. ")")
|
||||||
|
@ -340,6 +347,8 @@ local function new(args)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
capi.drawin.add_signal("property::get_wibox")
|
||||||
|
|
||||||
--- Redraw a wibox. You should never have to call this explicitely because it is
|
--- Redraw a wibox. You should never have to call this explicitely because it is
|
||||||
-- automatically called when needed.
|
-- automatically called when needed.
|
||||||
-- @param wibox
|
-- @param wibox
|
||||||
|
|
Loading…
Reference in New Issue