diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/vo.c | 9 | ||||
-rw-r--r-- | video/out/vo.h | 1 | ||||
-rw-r--r-- | video/out/vo_x11.c | 9 | ||||
-rw-r--r-- | video/out/vo_xv.c | 10 |
4 files changed, 23 insertions, 6 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 02d51bf7b6..f3af26273d 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -586,10 +586,7 @@ const char *vo_get_window_title(struct vo *vo) */ void vo_mouse_movement(struct vo *vo, int posx, int posy) { - char cmd_str[40]; - if (!vo->opts->enable_mouse_movements) - return; - snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy); - mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(bstr0(cmd_str), "")); + if (!vo->opts->enable_mouse_movements) + return; + mp_input_set_mouse_pos(vo->input_ctx, posx, posy); } - diff --git a/video/out/vo.h b/video/out/vo.h index 9f4d2a9060..9300fa37c0 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -71,6 +71,7 @@ enum mp_voctrl { VOCTRL_GET_DEINTERLACE, VOCTRL_UPDATE_SCREENINFO, + VOCTRL_WINDOW_TO_OSD_COORDS, // float[2] (x/y) VOCTRL_SET_YUV_COLORSPACE, // struct mp_csp_details* VOCTRL_GET_YUV_COLORSPACE, // struct mp_csp_details* diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index e7b595ff67..b86f851334 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -638,6 +638,7 @@ static int preinit(struct vo *vo, const char *arg) static int control(struct vo *vo, uint32_t request, void *data) { + struct priv *p = vo->priv; switch (request) { case VOCTRL_SET_EQUALIZER: { @@ -656,6 +657,14 @@ static int control(struct vo *vo, uint32_t request, void *data) return VO_TRUE; case VOCTRL_REDRAW_FRAME: return redraw_frame(vo); + case VOCTRL_WINDOW_TO_OSD_COORDS: { + // OSD is rendered into the scaled image + float *c = data; + struct mp_rect *dst = &p->dst; + c[0] = av_clipf(c[0], dst->x0, dst->x1) - dst->x0; + c[1] = av_clipf(c[1], dst->y0, dst->y1) - dst->y0; + return VO_TRUE; + } case VOCTRL_SCREENSHOT: { struct voctrl_screenshot_args *args = data; args->out_image = get_screenshot(vo); diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index fd8901da80..b40add2273 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -944,6 +944,16 @@ static int control(struct vo *vo, uint32_t request, void *data) args->out_image = get_screenshot(vo); return true; } + case VOCTRL_WINDOW_TO_OSD_COORDS: { + float *c = data; + struct mp_rect *src = &ctx->src_rect; + struct mp_rect *dst = &ctx->dst_rect; + c[0] = av_clipf(c[0], dst->x0, dst->x1) - dst->x0; + c[1] = av_clipf(c[1], dst->y0, dst->y1) - dst->y0; + c[0] = c[0] / (dst->x1 - dst->x0) * (src->x1 - src->x0) + src->x0; + c[1] = c[1] / (dst->y1 - dst->y0) * (src->y1 - src->y0) + src->y0; + return VO_TRUE; + } } int events = 0; int r = vo_x11_control(vo, &events, request, data); |