summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authortorque <torque@1>2015-02-28 17:22:31 -0800
committerwm4 <wm4@nowhere>2015-03-01 13:08:39 +0100
commit1bbf1eb3ce2bdb0ef3ec3b045074bcb2f3af6a7a (patch)
tree4bb09a373bb75ae5cb576eff1d43124900b365f3 /player/lua.c
parenta76cc1dafcf948cce93f6d258e33444206a83c45 (diff)
downloadmpv-1bbf1eb3ce2bdb0ef3ec3b045074bcb2f3af6a7a.tar.bz2
mpv-1bbf1eb3ce2bdb0ef3ec3b045074bcb2f3af6a7a.tar.xz
Lua: add mp.get_screen_margins().
When used with mp.get_screen_size(), mp.get_screen_margins() allows a Lua script to determine what portion of the mpv window actually has the video in it.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/player/lua.c b/player/lua.c
index 47bcc07110..f329c47d11 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -971,6 +971,17 @@ static int script_get_screen_size(lua_State *L)
return 3;
}
+static int script_get_screen_margins(lua_State *L)
+{
+ struct MPContext *mpctx = get_mpctx(L);
+ struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_EXTERNAL);
+ lua_pushnumber(L, vo_res.ml);
+ lua_pushnumber(L, vo_res.mt);
+ lua_pushnumber(L, vo_res.mr);
+ lua_pushnumber(L, vo_res.mb);
+ return 4;
+}
+
static int script_get_mouse_pos(lua_State *L)
{
struct MPContext *mpctx = get_mpctx(L);
@@ -1280,6 +1291,7 @@ static const struct fn_entry main_fns[] = {
FN_ENTRY(set_osd_ass),
FN_ENTRY(get_osd_resolution),
FN_ENTRY(get_screen_size),
+ FN_ENTRY(get_screen_margins),
FN_ENTRY(get_mouse_pos),
FN_ENTRY(get_time),
FN_ENTRY(input_define_section),