mouse: Add the current_widget_geometry property

Apparently, __index cannot return multiple values, so the previous
code wasn't working.
This commit is contained in:
Emmanuel Lepage Vallee 2016-05-28 22:08:47 -04:00
parent 23ad19d988
commit ce5cdb49ed
1 changed files with 23 additions and 2 deletions

View File

@ -284,7 +284,6 @@ end
-- @treturn table The list of widgets.The first element is the biggest -- @treturn table The list of widgets.The first element is the biggest
-- container while the last is the topmost widget. The table contains *x*, *y*, -- container while the last is the topmost widget. The table contains *x*, *y*,
-- *width*, *height* and *widget*. -- *width*, *height* and *widget*.
-- @treturn table The list of geometries.
-- @see wibox.find_widgets -- @see wibox.find_widgets
function mouse.object.get_current_widgets() function mouse.object.get_current_widgets()
@ -308,8 +307,8 @@ end
-- @property current_widget -- @property current_widget
-- @tparam widget|nil widget The widget -- @tparam widget|nil widget The widget
-- @treturn ?widget The widget -- @treturn ?widget The widget
-- @treturn ?table The geometry.
-- @see wibox.find_widgets -- @see wibox.find_widgets
-- @see current_widget_geometry
function mouse.object.get_current_widget() function mouse.object.get_current_widget()
local wdgs, geos = mouse.object.get_current_widgets() local wdgs, geos = mouse.object.get_current_widgets()
@ -319,6 +318,28 @@ function mouse.object.get_current_widget()
end end
end end
--- Get the current widget geometry.
-- @property current_widget_geometry
-- @tparam ?table The geometry.
-- @see current_widget
function mouse.object.get_current_widget_geometry()
local _, ret = mouse.object.get_current_widget()
return ret
end
--- Get the current widget geometries.
-- @property current_widget_geometries
-- @tparam ?table A list of geometry tables.
-- @see current_widgets
function mouse.object.get_current_widget_geometries()
local _, ret = mouse.object.get_current_widgets()
return ret
end
--- True if the left mouse button is pressed. --- True if the left mouse button is pressed.
-- @property is_left_mouse_button_pressed -- @property is_left_mouse_button_pressed
-- @param boolean -- @param boolean