From 5404b3c374b814ab4f4b388caf9bd9689d041c69 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 property miss handler --- lib/wibox/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/wibox/init.lua b/lib/wibox/init.lua index 9c68b4cd5..fb95e7737 100644 --- a/lib/wibox/init.lua +++ b/lib/wibox/init.lua @@ -20,7 +20,7 @@ local base = require("wibox.widget.base") --- This provides widget box windows. Every wibox can also be used as if it were -- a drawin. All drawin functions and properties are also available on wiboxes! -- wibox -local wibox = { mt = {} } +local wibox = { mt = {}, object = {} } wibox.layout = require("wibox.layout") wibox.widget = require("wibox.widget") wibox.drawable = require("wibox.drawable") @@ -298,6 +298,7 @@ end local function new(args) local ret = object() local w = capi.drawin(args) + ret.drawin = w ret._drawable = wibox.drawable(w.drawable, { wibox = ret }, "wibox drawable (" .. object.modulename(3) .. ")") @@ -348,6 +349,13 @@ function wibox.mt:__call(...) return new(...) end +-- Extend the luaobject +object.properties(capi.drawin, { + getter_class = wibox.object, + setter_class = wibox.object, + auto_emit = true, +}) + return setmetatable(wibox, wibox.mt) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80