summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-06 00:31:47 +0200
committerwm4 <wm4@nowhere>2015-08-06 00:31:47 +0200
commitd6c99bcda2b4e2791c6b147f5ba9d9cd95c7be7f (patch)
treecc31efc6ab85fef7e30c3a560c2d691b60ff4528 /player/lua
parentcaebbded67195d7f234e620cadc25ec276f4abcc (diff)
downloadmpv-d6c99bcda2b4e2791c6b147f5ba9d9cd95c7be7f.tar.bz2
mpv-d6c99bcda2b4e2791c6b147f5ba9d9cd95c7be7f.tar.xz
lua: implement input_enable_section/input_disable_section via commands
Removes some more internal API calls from the Lua scripting backend. Which is good, because ideally the scripting backend would use libmpv functions only. One awkwardness is that mouse sections are still not supported by the public commands (and probably will never), so flags like allow-hide- cursor make no sense to an outside user. Also, the way flags are passed to the Lua function changes. But that's ok, because they're only undocumented internal functions, and not supposed to be used by script users. osc.lua only does due to historical reasons.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/defaults.lua13
-rw-r--r--player/lua/osc.lua2
2 files changed, 13 insertions, 2 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index bc9114ffa5..d0ef57cccd 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -31,6 +31,17 @@ function mp.input_define_section(section, contents, flags)
mp.commandv("define-section", section, contents, flags)
end
+function mp.input_enable_section(section, flags)
+ if flags == nil then
+ flags = ""
+ end
+ mp.commandv("enable-section", section, flags)
+end
+
+function mp.input_disable_section(section)
+ mp.commandv("disable-section", section)
+end
+
-- For dispatching script_binding. This is sent as:
-- script_message_to $script_name $binding_name $keystate
-- The array is indexed by $binding_name, and has functions like this as value:
@@ -140,7 +151,7 @@ local function update_key_bindings()
end
mp.input_define_section(section, cfg, flags)
-- TODO: remove the section if the script is stopped
- mp.input_enable_section(section, "allow-hide-cursor|allow-vo-dragging")
+ mp.input_enable_section(section, "allow-hide-cursor+allow-vo-dragging")
end
end
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 8ce146d8e3..e131127922 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -1935,7 +1935,7 @@ end
function do_enable_keybindings()
if state.enabled then
- mp.enable_key_bindings("showhide", "allow-vo-dragging|allow-hide-cursor")
+ mp.enable_key_bindings("showhide", "allow-vo-dragging+allow-hide-cursor")
end
end