diff options
Diffstat (limited to 'input.lua')
| -rw-r--r-- | input.lua | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -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) |
