diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-05 15:58:24 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-07 01:14:03 -0800 |
commit | 83aab1d4be67fceb8c0cd27297cca086f1a9c3c5 (patch) | |
tree | d4a891eeda04b79074e2f911c041702f2bc371e4 /video/out/x11_common.c | |
parent | c920a3920e34fe7b1e501bf8a513ab2a23769af6 (diff) | |
download | mpv-83aab1d4be67fceb8c0cd27297cca086f1a9c3c5.tar.bz2 mpv-83aab1d4be67fceb8c0cd27297cca086f1a9c3c5.tar.xz |
vo/x11: implement VOCTRL_GET_DISPLAY_NAMES with xrandr names (e.g., "LVDS1")
XRRGetOutputInfo contains a "name" element which corresponds to to the
display names given to the user by the "xrandr" command line
utility. Copy it into the xrandr_display struct for each display.
On VOCTRL_GET_DISPLAY_NAMES, send a copy of the names
of the displays spanned by the mpv window on.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r-- | video/out/x11_common.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c index fb3fbe14ff..b8544ef398 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -330,6 +330,9 @@ static int vo_wm_detect(struct vo *vo) static void xrandr_read(struct vo_x11_state *x11) { #if HAVE_XRANDR + for(int i = 0; i < x11->num_displays; i++) + talloc_free(x11->displays[i].name); + x11->num_displays = 0; if (x11->xrandr_event < 0) { @@ -375,10 +378,11 @@ static void xrandr_read(struct vo_x11_state *x11) .rc = { crtc->x, crtc->y, crtc->x + crtc->width, crtc->y + crtc->height }, .fps = m.dotClock / (m.hTotal * vTotal), + .name = talloc_strdup(x11, out->name), }; int num = x11->num_displays++; - MP_VERBOSE(x11, "Display %d: [%d, %d, %d, %d] @ %f FPS\n", - num, d.rc.x0, d.rc.y0, d.rc.x1, d.rc.y1, d.fps); + MP_VERBOSE(x11, "Display %d (%s): [%d, %d, %d, %d] @ %f FPS\n", + num, d.name, d.rc.x0, d.rc.y0, d.rc.x1, d.rc.y1, d.fps); x11->displays[num] = d; } } @@ -1601,6 +1605,18 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) } return VO_TRUE; } + case VOCTRL_GET_DISPLAY_NAMES: { + char **names = NULL; + int displays_spanned = 0; + for (int n = 0; n < x11->num_displays; n++) { + if (rc_overlaps(x11->displays[n].rc, x11->winrc)) + MP_TARRAY_APPEND(NULL, names, displays_spanned, + talloc_strdup(NULL, x11->displays[n].name)); + } + MP_TARRAY_APPEND(NULL, names, displays_spanned, NULL); + *(char ***)arg = names; + return VO_TRUE; + } case VOCTRL_SET_CURSOR_VISIBILITY: vo_set_cursor_hidden(vo, !(*(bool *)arg)); return VO_TRUE; |