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.
This commit is contained in:
wm4 committed 2015-08-06 00:31:47 +02:00
1 parent caebbded67
commit d6c99bcda2
6 files changed
+31 -44

No files matched your search

+12 -1
View File
@@ -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