From 19252f87fe687b1c8525116c98cf24e52e83560a Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 20 Aug 2014 11:26:09 +0200 Subject: [PATCH] wbox: Make :find_widgets() easily accessible Signed-off-by: Uli Schlachter --- lib/wibox/init.lua.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/wibox/init.lua.in b/lib/wibox/init.lua.in index 3342ec4c5..aa93996b0 100644 --- a/lib/wibox/init.lua.in +++ b/lib/wibox/init.lua.in @@ -48,6 +48,16 @@ function wibox:set_fg(c) self._drawable:set_fg(c) 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 wibox[k] = function(self, ...) return self.drawin[k](self.drawin, ...)