From baf290a8b22560d3d860bb75ec1429442417093b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 2 May 2016 23:57:33 -0400 Subject: [PATCH] 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. --- lib/wibox/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/wibox/init.lua b/lib/wibox/init.lua index fb95e773..213da7e6 100644 --- a/lib/wibox/init.lua +++ b/lib/wibox/init.lua @@ -299,6 +299,13 @@ local function new(args) local ret = object() 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._drawable = wibox.drawable(w.drawable, { wibox = ret }, "wibox drawable (" .. object.modulename(3) .. ")") @@ -340,6 +347,8 @@ local function new(args) return ret end +capi.drawin.add_signal("property::get_wibox") + --- Redraw a wibox. You should never have to call this explicitely because it is -- automatically called when needed. -- @param wibox