diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-25 00:24:18 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-25 00:25:00 -0800 |
| commit | 1d2c82bfb4dcfd71045f2948bb320a94013971a5 (patch) | |
| tree | 33282ef00974badcfdeba14d4a7f78efcf6920e0 /input.lua | |
| parent | 6c9ad9a77dd67145b9015bb13018534025e33a49 (diff) | |
| download | mpv-iptv-menu-1d2c82bfb4dcfd71045f2948bb320a94013971a5.tar.gz mpv-iptv-menu-1d2c82bfb4dcfd71045f2948bb320a94013971a5.tar.xz | |
more explicit activation of key handler
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) |
