wbox: Make :find_widgets() easily accessible

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-08-20 11:26:09 +02:00
parent a74b3fccaa
commit 19252f87fe
1 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,16 @@ function wibox:set_fg(c)
self._drawable:set_fg(c) self._drawable:set_fg(c)
end end
--- Find a widget by a point.
-- The wibox must have drawn itself at least once for this to work.
-- @param x X coordinate of the point
-- @param y Y coordinate of the point
-- @return A sorted table with all widgets that contain the given point. The
-- widgets are sorted by relevance.
function wibox:find_widgets(x, y)
return self._drawable:find_widgets(x, y)
end
for _, k in pairs{ "buttons", "struts", "geometry", "get_xproperty", "set_xproperty" } do for _, k in pairs{ "buttons", "struts", "geometry", "get_xproperty", "set_xproperty" } do
wibox[k] = function(self, ...) wibox[k] = function(self, ...)
return self.drawin[k](self.drawin, ...) return self.drawin[k](self.drawin, ...)