From a39b93f2e3306dc8da9a0596889f80820c16457b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Apr 2016 22:51:36 -0400 Subject: [PATCH] mouse: Add is_*_mouse_button_pressed helper properties. --- lib/awful/mouse/init.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/awful/mouse/init.lua b/lib/awful/mouse/init.lua index 14c40548..3ad0b0a2 100644 --- a/lib/awful/mouse/init.lua +++ b/lib/awful/mouse/init.lua @@ -296,6 +296,26 @@ end function mouse.object.set_current_wibox() end +--- True if the left mouse button is pressed. +-- @property is_left_mouse_button_pressed +-- @param boolean + +--- True if the right mouse button is pressed. +-- @property is_right_mouse_button_pressed +-- @param boolean + +--- True if the middle mouse button is pressed. +-- @property is_middle_mouse_button_pressed +-- @param boolean + +for _, b in ipairs {"left", "right", "middle"} do + mouse.object["is_".. b .."_mouse_button_pressed"] = function() + return capi.mouse.coords().buttons[1] + end + + mouse.object["set_is_".. b .."_mouse_button_pressed"] = function() end +end + capi.client.connect_signal("request::geometry", mouse.resize_handler) -- Set the cursor at startup