diff options
author | wm4 <wm4@nowhere> | 2016-03-07 22:20:51 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-03-07 22:22:18 +0100 |
commit | 5fa45fb5641c95a5dc65faac2087d842333b5425 (patch) | |
tree | 0807f5cff191b18427b36ebf5d30de25620ae033 /player/lua.c | |
parent | b7617f42d873adceebd3904d906e4eff818240ed (diff) | |
download | mpv-5fa45fb5641c95a5dc65faac2087d842333b5425.tar.bz2 mpv-5fa45fb5641c95a5dc65faac2087d842333b5425.tar.xz |
osd, lua: remove weird OSD scaling
Do not scale OSD mouse input to the ASS OSD script resolution. The
original idea of this mechanism was that the user doesn't have to care
about the actual resolution of anything, and can just use the OSD
resolution consistently. But this made things worse.
Remove the implicit scaling, and always use the screen resolution.
(Except with --vo=xv, where additional scaling is forced upon
everything.)
Drop get_osd_resolution(). There is no replacement. Rename
get_screen_size() and get_screen_margins() to use "osd" instead of
"screen". For anything but --vo=xv these are equivalent, but with
--vo=xv the OSD resolution has additional implicit scaling.
Add code to osc.lua which emulates the old behavior.
Note that none of the changed functions were public API, so implicit
breakage of scripts which used it is just going to happen.
Diffstat (limited to 'player/lua.c')
-rw-r--r-- | player/lua.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/player/lua.c b/player/lua.c index 9fe1d0deca..04c7dbb977 100644 --- a/player/lua.c +++ b/player/lua.c @@ -974,17 +974,7 @@ static int script_set_osd_ass(lua_State *L) return 0; } -static int script_get_osd_resolution(lua_State *L) -{ - struct MPContext *mpctx = get_mpctx(L); - int w, h; - osd_object_get_resolution(mpctx->osd, OSDTYPE_EXTERNAL, &w, &h); - lua_pushnumber(L, w); - lua_pushnumber(L, h); - return 2; -} - -static int script_get_screen_size(lua_State *L) +static int script_get_osd_size(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_EXTERNAL); @@ -996,7 +986,7 @@ static int script_get_screen_size(lua_State *L) return 3; } -static int script_get_screen_margins(lua_State *L) +static int script_get_osd_margins(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_EXTERNAL); @@ -1012,10 +1002,8 @@ static int script_get_mouse_pos(lua_State *L) struct MPContext *mpctx = get_mpctx(L); int px, py; mp_input_get_mouse_pos(mpctx->input, &px, &py); - double sw, sh; - osd_object_get_scale_factor(mpctx->osd, OSDTYPE_EXTERNAL, &sw, &sh); - lua_pushnumber(L, px * sw); - lua_pushnumber(L, py * sh); + lua_pushnumber(L, px); + lua_pushnumber(L, py); return 2; } @@ -1030,14 +1018,11 @@ static int script_input_set_section_mouse_area(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); - double sw, sh; - osd_object_get_scale_factor(mpctx->osd, OSDTYPE_EXTERNAL, &sw, &sh); - char *section = (char *)luaL_checkstring(L, 1); - int x0 = sw ? luaL_checkinteger(L, 2) / sw : 0; - int y0 = sh ? luaL_checkinteger(L, 3) / sh : 0; - int x1 = sw ? luaL_checkinteger(L, 4) / sw : 0; - int y1 = sh ? luaL_checkinteger(L, 5) / sh : 0; + int x0 = luaL_checkinteger(L, 2); + int y0 = luaL_checkinteger(L, 3); + int x1 = luaL_checkinteger(L, 4); + int y1 = luaL_checkinteger(L, 5); mp_input_set_section_mouse_area(mpctx->input, section, x0, y0, x1, y1); return 0; } @@ -1266,9 +1251,8 @@ static const struct fn_entry main_fns[] = { FN_ENTRY(raw_observe_property), FN_ENTRY(raw_unobserve_property), FN_ENTRY(set_osd_ass), - FN_ENTRY(get_osd_resolution), - FN_ENTRY(get_screen_size), - FN_ENTRY(get_screen_margins), + FN_ENTRY(get_osd_size), + FN_ENTRY(get_osd_margins), FN_ENTRY(get_mouse_pos), FN_ENTRY(get_time), FN_ENTRY(input_set_section_mouse_area), |