summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst4
-rw-r--r--player/command.c12
-rw-r--r--video/out/vo.h1
-rw-r--r--video/out/x11_common.c6
4 files changed, 23 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 9e9557afd5..e11beae92c 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2652,6 +2652,10 @@ Property list
Any of these properties may be unavailable or set to dummy values if the
VO window is not created or visible.
+``window-id``
+ Read-only - mpv's window id. May not always be available, i.e due to window
+ not being opened yet or not being supported by the VO.
+
``mouse-pos``
Read-only - last known mouse position, normalizd to OSD dimensions.
diff --git a/player/command.c b/player/command.c
index 2e6b9875d7..28ca602ef8 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1344,6 +1344,17 @@ static int mp_property_idle(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, mpctx->stop_play == PT_STOP);
}
+static int mp_property_window_id(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct vo *vo = mpctx->video_out;
+ int64_t wid;
+ if (!vo || vo_control(vo, VOCTRL_GET_WINDOW_ID, &wid) <= 0)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_int64_ro(action, arg, wid);
+}
+
static int mp_property_eof_reached(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3616,6 +3627,7 @@ static const struct m_property mp_properties_base[] = {
{"seekable", mp_property_seekable},
{"partially-seekable", mp_property_partially_seekable},
{"idle-active", mp_property_idle},
+ {"window-id", mp_property_window_id},
{"chapter-list", mp_property_list_chapters},
{"track-list", property_list_tracks},
diff --git a/video/out/vo.h b/video/out/vo.h
index c7ac9c9c59..98e13cd890 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -126,6 +126,7 @@ enum mp_voctrl {
VOCTRL_GET_DISPLAY_FPS, // double*
VOCTRL_GET_HIDPI_SCALE, // double*
VOCTRL_GET_DISPLAY_RES, // int[2]
+ VOCTRL_GET_WINDOW_ID, // int64_t*
/* private to vo_gpu and vo_gpu_next */
VOCTRL_EXTERNAL_RESIZE,
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 5dc844da4d..b6c191d376 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -2118,6 +2118,12 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
((int *)arg)[1] = selected_disp->rc.y1 - selected_disp->rc.y0;
return VO_TRUE;
}
+ case VOCTRL_GET_WINDOW_ID: {
+ if (!x11->window)
+ return VO_NOTAVAIL;
+ *(int64_t *)arg = x11->window;
+ return VO_TRUE;
+ }
case VOCTRL_GET_HIDPI_SCALE:
*(double *)arg = x11->dpi_scale;
return VO_TRUE;