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.
Showing the changes to player/lua/defaults.lua (1 of 6 files). Show all
Unified · Split
| @@ -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) |
| 32 | end | 32 | end |
| 33 | 33 | ||
| 34 | function mp.input_enable_section(section, flags) | ||
| 35 | if flags == nil then | ||
| 36 | flags = "" | ||
| 37 | end | ||
| 38 | mp.commandv("enable-section", section, flags) | ||
| 39 | end | ||
| 40 | |||
| 41 | function mp.input_disable_section(section) | ||
| 42 | mp.commandv("disable-section", section) | ||
| 43 | end | ||
| 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 $keystate | 46 | -- 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 | end | 151 | 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 stopped | 153 | -- 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 | end | 155 | end |
| 145 | end | 156 | end |
| 146 | 157 | ||