summaryrefslogtreecommitdiffstats
path: root/mpvcore/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-13 00:19:17 +0100
committerwm4 <wm4@nowhere>2013-12-13 00:19:17 +0100
commitb0bd93cbc18032dde6abb42cbc3068e906622e48 (patch)
treec645527986f85a5ea735ff81c2fcd0115651489b /mpvcore/player
parent88432b817d0ca115ff97ec76065f1dabcb5f9137 (diff)
downloadmpv-b0bd93cbc18032dde6abb42cbc3068e906622e48.tar.bz2
mpv-b0bd93cbc18032dde6abb42cbc3068e906622e48.tar.xz
dvdnav: support mouse interaction
Diffstat (limited to 'mpvcore/player')
-rw-r--r--mpvcore/player/dvdnav.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/mpvcore/player/dvdnav.c b/mpvcore/player/dvdnav.c
index 879bacd1c1..6efa786996 100644
--- a/mpvcore/player/dvdnav.c
+++ b/mpvcore/player/dvdnav.c
@@ -100,9 +100,22 @@ void mp_nav_user_input(struct MPContext *mpctx, char *command)
struct mp_nav_state *nav = mpctx->nav_state;
if (!nav)
return;
- struct mp_nav_cmd inp = {MP_NAV_CMD_MENU};
- inp.u.menu.action = command;
- stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
+ if (strcmp(command, "mouse_move") == 0) {
+ struct mp_image_params vid = {0};
+ if (mpctx->d_video)
+ vid = mpctx->d_video->decoder_output;
+ struct mp_nav_cmd inp = {MP_NAV_CMD_MOUSE_POS};
+ int x, y;
+ mp_input_get_mouse_pos(mpctx->input, &x, &y);
+ osd_coords_to_video(mpctx->osd, vid.w, vid.h, &x, &y);
+ inp.u.mouse_pos.x = x;
+ inp.u.mouse_pos.y = y;
+ stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
+ } else {
+ struct mp_nav_cmd inp = {MP_NAV_CMD_MENU};
+ inp.u.menu.action = command;
+ stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
+ }
}
void mp_handle_nav(struct MPContext *mpctx)