summaryrefslogtreecommitdiff
path: root/input.lua
diff options
context:
space:
mode:
Diffstat (limited to 'input.lua')
-rw-r--r--input.lua25
1 files changed, 12 insertions, 13 deletions
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)