2016-05-03 05:56:08 +02:00
|
|
|
local gears_obj = require("gears.object")
|
|
|
|
|
|
|
|
local drawin, meta = awesome._shim_fake_class()
|
2017-05-15 08:24:52 +02:00
|
|
|
local drawins = setmetatable({}, {__mode="v"})
|
2018-09-30 08:12:57 +02:00
|
|
|
local cairo = require("lgi").cairo
|
2016-05-03 05:56:08 +02:00
|
|
|
|
|
|
|
local function new_drawin(_, args)
|
|
|
|
local ret = gears_obj()
|
2017-05-29 10:53:49 +02:00
|
|
|
ret.data = {drawable = gears_obj()}
|
2016-05-03 05:56:08 +02:00
|
|
|
|
2017-05-15 08:24:52 +02:00
|
|
|
ret.x=0
|
|
|
|
ret.y=0
|
|
|
|
ret.width=1
|
|
|
|
ret.height=1
|
2018-12-22 03:19:59 +01:00
|
|
|
ret.border_width=0
|
|
|
|
ret.ontop = false
|
|
|
|
ret.below = false
|
|
|
|
ret.above = false
|
2017-05-15 08:24:52 +02:00
|
|
|
|
|
|
|
ret.geometry = function(_, new)
|
|
|
|
new = new or {}
|
|
|
|
ret.x = new.x or ret.x
|
|
|
|
ret.y = new.y or ret.y
|
|
|
|
ret.width = new.width or ret.width
|
|
|
|
ret.height = new.height or ret.height
|
|
|
|
return {
|
|
|
|
x = ret.x,
|
|
|
|
y = ret.y,
|
|
|
|
width = ret.width,
|
|
|
|
height = ret.height
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-09-30 08:12:57 +02:00
|
|
|
ret.data.drawable.valid = true
|
|
|
|
ret.data.drawable.surface = cairo.ImageSurface(cairo.Format.ARGB32, 0, 0)
|
|
|
|
ret.data.drawable.geometry = ret.geometry
|
|
|
|
ret.data.drawable.refresh = function() end
|
2019-07-18 06:20:58 +02:00
|
|
|
ret.data._struts = { top = 0, right = 0, left = 0, bottom = 0 }
|
2018-09-30 08:12:57 +02:00
|
|
|
|
2019-07-18 06:20:58 +02:00
|
|
|
for _, k in pairs{ "buttons", "get_xproperty", "set_xproperty" } do
|
2017-05-15 08:24:52 +02:00
|
|
|
ret[k] = function() end
|
2016-05-03 05:56:08 +02:00
|
|
|
end
|
|
|
|
|
2019-07-18 06:20:58 +02:00
|
|
|
function ret:struts(new)
|
|
|
|
for k, v in pairs(new or {}) do
|
|
|
|
ret.data._struts[k] = v
|
|
|
|
end
|
|
|
|
|
|
|
|
return ret.data._struts
|
|
|
|
end
|
|
|
|
|
2017-05-15 08:24:52 +02:00
|
|
|
local md = setmetatable(ret, {
|
2016-12-27 21:39:08 +01:00
|
|
|
__index = function(...) return meta.__index(...) end,
|
|
|
|
__newindex = function(...) return meta.__newindex(...) end
|
|
|
|
})
|
2017-05-15 08:24:52 +02:00
|
|
|
|
|
|
|
for k, v in pairs(args) do
|
|
|
|
ret[k] = v
|
|
|
|
end
|
|
|
|
|
|
|
|
table.insert(drawins, md)
|
|
|
|
|
|
|
|
return md
|
|
|
|
end
|
|
|
|
|
|
|
|
function drawin.get()
|
|
|
|
return drawins
|
2016-05-03 05:56:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(drawin, {
|
2016-12-27 21:39:08 +01:00
|
|
|
__call = new_drawin,
|
|
|
|
})
|
2016-05-03 05:56:08 +02:00
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|