lib/wibox: Make signals from drawables available
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
10d48e1fc8
commit
fa86fbeb52
|
@ -174,10 +174,33 @@ local function handle_motion(_drawable, x, y)
|
||||||
_drawable._widgets_under_mouse = widgets
|
_drawable._widgets_under_mouse = widgets
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function setup_signals(_drawable)
|
||||||
|
local d = _drawable.drawable
|
||||||
|
|
||||||
|
local function clone_signal(name)
|
||||||
|
_drawable:add_signal(name)
|
||||||
|
-- When "name" is emitted on wibox.drawin, also emit it on wibox
|
||||||
|
d:connect_signal(name, function(_, ...)
|
||||||
|
_drawable:emit_signal(name, ...)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
clone_signal("button::press")
|
||||||
|
clone_signal("button::release")
|
||||||
|
clone_signal("mouse::enter")
|
||||||
|
clone_signal("mouse::leave")
|
||||||
|
clone_signal("mouse::move")
|
||||||
|
clone_signal("property::surface")
|
||||||
|
clone_signal("property::width")
|
||||||
|
clone_signal("property::height")
|
||||||
|
clone_signal("property::x")
|
||||||
|
clone_signal("property::y")
|
||||||
|
end
|
||||||
|
|
||||||
function drawable.new(d, widget_arg, redraw_hook)
|
function drawable.new(d, widget_arg, redraw_hook)
|
||||||
local ret = object()
|
local ret = object()
|
||||||
ret.drawable = d
|
ret.drawable = d
|
||||||
ret.widget_arg = widget_arg or ret
|
ret.widget_arg = widget_arg or ret
|
||||||
|
setup_signals(ret)
|
||||||
|
|
||||||
for k, v in pairs(drawable) do
|
for k, v in pairs(drawable) do
|
||||||
if type(v) == "function" then
|
if type(v) == "function" then
|
||||||
|
|
|
@ -88,6 +88,21 @@ local function setup_signals(_wibox)
|
||||||
clone_signal("property::width")
|
clone_signal("property::width")
|
||||||
clone_signal("property::x")
|
clone_signal("property::x")
|
||||||
clone_signal("property::y")
|
clone_signal("property::y")
|
||||||
|
|
||||||
|
local d = _wibox._drawable
|
||||||
|
local function clone_signal(name)
|
||||||
|
_wibox:add_signal(name)
|
||||||
|
-- When "name" is emitted on wibox.drawin, also emit it on wibox
|
||||||
|
d:connect_signal(name, function(_, ...)
|
||||||
|
_wibox:emit_signal(name, ...)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
clone_signal("button::press")
|
||||||
|
clone_signal("button::release")
|
||||||
|
clone_signal("mouse::enter")
|
||||||
|
clone_signal("mouse::leave")
|
||||||
|
clone_signal("mouse::move")
|
||||||
|
clone_signal("property::surface")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function new(args)
|
local function new(args)
|
||||||
|
|
Loading…
Reference in New Issue