From 1d2c82bfb4dcfd71045f2948bb320a94013971a5 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 25 Jan 2026 00:24:18 -0800 Subject: more explicit activation of key handler --- input.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'input.lua') diff --git a/input.lua b/input.lua index df339b1..ae3002e 100644 --- a/input.lua +++ b/input.lua @@ -154,28 +154,27 @@ end -- -- nonexistent `nodrag' section is enabled to disable VO dragging while the -- menu is open. -function input.set_key_bindings() - if osd:is_hidden() then - if mapping_bound then - mp.remove_key_binding('mouse_move') - mp.remove_key_binding('unmapped') - mp.command_native({'disable-section', 'nodrag'}) - mp.command_native({ - 'enable-section', 'default', - 'allow-hide-cursor+allow-vo-dragging'}) - mapping_bound = false - end +function input.activate(bool) + if mapping_bound == bool then return end - if not mapping_bound then + if bool then mp.command_native({'disable-section', 'default'}) mp.command_native({'enable-section', 'nodrag'}) mp.add_forced_key_binding('MOUSE_MOVE', 'mouse_move') -- noisy mp.add_forced_key_binding( 'UNMAPPED', 'unmapped', handle_key, {complex = true}) - mapping_bound = true + else + mp.remove_key_binding('mouse_move') + mp.remove_key_binding('unmapped') + mp.command_native({'disable-section', 'nodrag'}) + mp.command_native({ + 'enable-section', 'default', + 'allow-hide-cursor+allow-vo-dragging'}) end + + mapping_bound = bool end local function bind_click(f) -- cgit v1.2.3-70-g09d2