From 5e5f587beadefc90b99f09643e3a05655a386c48 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 30 May 2021 23:55:07 -0700 Subject: [PATCH] mouse: Fix the "is button X pressed" properties. Apparently it never worked. Fix #3352 --- lib/awful/mouse/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/awful/mouse/init.lua b/lib/awful/mouse/init.lua index fac053e9..f42b0d1a 100644 --- a/lib/awful/mouse/init.lua +++ b/lib/awful/mouse/init.lua @@ -341,9 +341,9 @@ function mouse.remove_client_mousebinding(button) return false end -for _, b in ipairs {"left", "right", "middle"} do +for k, b in ipairs {"left", "middle", "right"} do mouse.object["is_".. b .."_mouse_button_pressed"] = function() - return capi.mouse.coords().buttons[1] + return capi.mouse.coords().buttons[k] end end @@ -367,6 +367,10 @@ end) capi.mouse.set_index_miss_handler(function(_,key) if mouse.object["get_"..key] then return mouse.object["get_"..key]() + elseif mouse.object[key] and key:sub(1, 3) == "is_" then + return mouse.object[key]() + elseif mouse.object[key] then + return mouse.object[key] else return props[key] end