summaryrefslogtreecommitdiffstats
path: root/mpvcore/mp_lua.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-27 15:39:28 +0200
committerwm4 <wm4@nowhere>2013-09-27 15:39:28 +0200
commitede652774ee83d2d311763358a1d3b820d9f5e17 (patch)
treef14c07a4fec55eb932e979f353843dba08583657 /mpvcore/mp_lua.c
parent3871024ec32aaed04fe93a6b7af1c9d0df8f6248 (diff)
downloadmpv-ede652774ee83d2d311763358a1d3b820d9f5e17.tar.bz2
mpv-ede652774ee83d2d311763358a1d3b820d9f5e17.tar.xz
input: translate mouse position to OSD space early
Until now, mouse positions were just passed to the core as-is, even if the mouse coordinates didn't map to any useful coordinate space, like OSD coordinates. Lua scripting (used by the OSC, the only current user of mouse input) had to translate mouse coordinates manually to OSD space using mp_get_osd_mouse_pos(). This actually didn't work correctly in cases mouse coordinates didn't map to OSD (like vo_xv): the mouse coordinates the OSC got were correct, but input.c was still expecting "real" mosue coordinates for mouse areas. Fix this by converting to OSD coordinates before passing the mouse position to the core.
Diffstat (limited to 'mpvcore/mp_lua.c')
-rw-r--r--mpvcore/mp_lua.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mpvcore/mp_lua.c b/mpvcore/mp_lua.c
index e03f3e6aee..4741cb1f33 100644
--- a/mpvcore/mp_lua.c
+++ b/mpvcore/mp_lua.c
@@ -457,8 +457,8 @@ static int script_get_screen_size(lua_State *L)
static int script_get_mouse_pos(lua_State *L)
{
struct MPContext *mpctx = get_mpctx(L);
- float px, py;
- mp_get_osd_mouse_pos(mpctx, &px, &py);
+ int px, py;
+ mp_input_get_mouse_pos(mpctx->input, &px, &py);
double sw, sh;
osd_object_get_scale_factor(mpctx->osd, mpctx->osd->objs[OSDTYPE_EXTERNAL],
&sw, &sh);