diff options
author | wm4 <wm4@nowhere> | 2015-08-06 00:31:47 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-06 00:31:47 +0200 |
commit | d6c99bcda2b4e2791c6b147f5ba9d9cd95c7be7f (patch) | |
tree | cc31efc6ab85fef7e30c3a560c2d691b60ff4528 /player/lua.c | |
parent | caebbded67195d7f234e620cadc25ec276f4abcc (diff) | |
download | mpv-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.c')
-rw-r--r-- | player/lua.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/player/lua.c b/player/lua.c index 3621e7aee5..cf0c5caa41 100644 --- a/player/lua.c +++ b/player/lua.c @@ -1024,38 +1024,6 @@ static int script_get_time(lua_State *L) return 1; } -static int script_input_enable_section(lua_State *L) -{ - struct MPContext *mpctx = get_mpctx(L); - char *section = (char *)luaL_checkstring(L, 1); - char *sflags = (char *)luaL_optstring(L, 2, ""); - bstr bflags = bstr0(sflags); - int flags = 0; - while (bflags.len) { - bstr val; - bstr_split_tok(bflags, "|", &val, &bflags); - if (bstr_equals0(val, "allow-hide-cursor")) { - flags |= MP_INPUT_ALLOW_HIDE_CURSOR; - } else if (bstr_equals0(val, "allow-vo-dragging")) { - flags |= MP_INPUT_ALLOW_VO_DRAGGING; - } else if (bstr_equals0(val, "exclusive")) { - flags |= MP_INPUT_EXCLUSIVE; - } else { - luaL_error(L, "invalid flag"); - } - } - mp_input_enable_section(mpctx->input, section, flags); - return 0; -} - -static int script_input_disable_section(lua_State *L) -{ - struct MPContext *mpctx = get_mpctx(L); - char *section = (char *)luaL_checkstring(L, 1); - mp_input_disable_section(mpctx->input, section); - return 0; -} - static int script_input_set_section_mouse_area(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); @@ -1301,8 +1269,6 @@ static const struct fn_entry main_fns[] = { FN_ENTRY(get_screen_margins), FN_ENTRY(get_mouse_pos), FN_ENTRY(get_time), - FN_ENTRY(input_enable_section), - FN_ENTRY(input_disable_section), FN_ENTRY(input_set_section_mouse_area), FN_ENTRY(format_time), FN_ENTRY(enable_messages), |