From 47fffb5eee5be4c427f3120a070d594d365d385d Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Apr 2016 22:33:44 -0400 Subject: [PATCH] mouse: Add current_client property It is called wibox instead of drawin because from the user point of view, it will be a wibox anyway. --- lib/awful/mouse/init.lua | 42 +++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/awful/mouse/init.lua b/lib/awful/mouse/init.lua index 6c6794ba5..67468d74c 100644 --- a/lib/awful/mouse/init.lua +++ b/lib/awful/mouse/init.lua @@ -53,21 +53,11 @@ mouse.wibox = {} --- Get the client object under the pointer. -- @deprecated awful.mouse.client_under_pointer -- @return The client object under the pointer, if one can be found. +-- @see current_client function mouse.client_under_pointer() - local obj = capi.mouse.object_under_pointer() - if type(obj) == "client" then - return obj - end -end + util.deprecated("Use mouse.current_client instead of awful.mouse.client_under_pointer()") ---- Get the drawin object under the pointer. --- @deprecated awful.mouse.drawin_under_pointer --- @return The drawin object under the pointer, if one can be found. -function mouse.drawin_under_pointer() - local obj = capi.mouse.object_under_pointer() - if type(obj) == "drawin" then - return obj - end + return mouse.object.get_current_client() end --- Move a client. @@ -280,6 +270,32 @@ function mouse.resize_handler(c, context, hints) end end +--- Get the client currently under the mouse cursor. +-- @property current_client +-- @tparam client|nil The client + +function mouse.object.get_current_client() + local obj = capi.mouse.object_under_pointer() + if type(obj) == "client" then + return obj + end +end + +function mouse.object.set_current_client() end + +--- Get the wibox currently under the mouse cursor. +-- @property current_wibox +-- @tparam wibox|nil The wibox + +function mouse.object.get_current_wibox() + local obj = capi.mouse.object_under_pointer() + if type(obj) == "drawin" then + return obj + end +end + +function mouse.object.set_current_wibox() end + capi.client.connect_signal("request::geometry", mouse.resize_handler) -- Set the cursor at startup