History

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.

wm4 committed 11 years ago

Commit d6c99bc1 parent caebbde6 files · +31 −44Browse files

Showing the changes to player/lua/defaults.lua (1 of 6 files). Show all

Unified · Split

player/lua/defaults.lua+12−1
@@ -31,6 +31,17 @@ function mp.input_define_section(section, contents, flags) · 30 unmodified lines
31 mp.commandv("define-section", section, contents, flags)31 mp.commandv("define-section", section, contents, flags)
32end32end
33 33
34function mp.input_enable_section(section, flags)
35 if flags == nil then
36 flags = ""
37 end
38 mp.commandv("enable-section", section, flags)
39end
40
41function mp.input_disable_section(section)
42 mp.commandv("disable-section", section)
43end
44
34-- For dispatching script_binding. This is sent as:45-- For dispatching script_binding. This is sent as:
35-- script_message_to $script_name $binding_name $keystate46-- script_message_to $script_name $binding_name $keystate
36-- The array is indexed by $binding_name, and has functions like this as value:47-- The array is indexed by $binding_name, and has functions like this as value:
@@ -140,7 +151,7 @@ local function update_key_bindings() · 103 unmodified lines
140 end151 end
141 mp.input_define_section(section, cfg, flags)152 mp.input_define_section(section, cfg, flags)
142 -- TODO: remove the section if the script is stopped153 -- TODO: remove the section if the script is stopped
143 mp.input_enable_section(section, "allow-hide-cursor|allow-vo-dragging")154 mp.input_enable_section(section, "allow-hide-cursor+allow-vo-dragging")
144 end155 end
145end156end
146 157

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t