summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.lua b/main.lua
index 563c2cf..bf853b6 100644
--- a/main.lua
+++ b/main.lua
@@ -1277,6 +1277,10 @@ local function toggle_menu()
set_key_bindings()
end
+mp.set_key_bindings({
+ {'MBTN_LEFT', toggle_menu},
+ {'MBTN_LEFT_DBL'},
+}, 'toggle_button', 'force')
local mouse_pos_time
local mouse_over_button_area = false
local mouse_over_toggle_button = false
@@ -1320,12 +1324,9 @@ mp.observe_property('mouse-pos', 'native', function(_, mpos)
if is_over ~= mouse_over_toggle_button then
mouse_over_toggle_button = is_over
if mouse_over_toggle_button then
- mp.add_forced_key_binding(
- 'MBTN_LEFT', 'click', toggle_menu)
- mp.add_forced_key_binding('MBTN_LEFT_DBL', 'click_dbl')
+ mp.enable_key_bindings('toggle_button')
else
- mp.remove_key_binding('click')
- mp.remove_key_binding('click_dbl')
+ mp.disable_key_bindings('toggle_button')
end
end
end)