diff options
author | wm4 <wm4@nowhere> | 2013-01-27 12:01:08 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-27 13:32:27 +0100 |
commit | df80cd379ae2ea3fbbfd3f2a28e804b8882ea93a (patch) | |
tree | 4a29ae5b579a10baee13ee8065ad01beeefafe8f /video/out/vo_xv.c | |
parent | 75164a0e0a409958d10f56b3dabea35914daeba3 (diff) | |
download | mpv-df80cd379ae2ea3fbbfd3f2a28e804b8882ea93a.tar.bz2 mpv-df80cd379ae2ea3fbbfd3f2a28e804b8882ea93a.tar.xz |
x11: simplify handling of X Visuals and Colormaps in VOs
Don't force VOs to pick an arbitrary default Visual and Colormap. They
still can override them if needed. This simplifies the X11 VO interface.
Always create a Colormap for simplicity. Using CopyFromParent fails if
the selected visual is not the same of that of the parent window, which
happens for me with vo_opengl.
vo_vdpau and vo_xv explicitly set CWBorderPixel, do that in x11_common
instead (it was already done for native windows, but not for slave mode
windows).
What gl_common did was incorrect in theory: freeing a colormap while a
window uses it will change the colormap of the window to "None", and
the color mapping for such windows is "undefined".
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r-- | video/out/vo_xv.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index 58e549ee16..b5fd34991e 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -494,10 +494,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, uint32_t format) { struct vo_x11_state *x11 = vo->x11; - XVisualInfo vinfo; - XSetWindowAttributes xswa; - XWindowAttributes attribs; - unsigned long xswamask; struct xvctx *ctx = vo->priv; int i; @@ -530,23 +526,11 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, if (!ctx->xv_format) return -1; - { - XGetWindowAttributes(x11->display, DefaultRootWindow(x11->display), - &attribs); - XMatchVisualInfo(x11->display, x11->screen, attribs.depth, TrueColor, - &vinfo); - - xswa.border_pixel = 0; - xswamask = CWBorderPixel; - if (ctx->xv_ck_info.method == CK_METHOD_BACKGROUND) { - xswa.background_pixel = ctx->xv_colorkey; - xswamask |= CWBackPixel; - } + vo_x11_create_vo_window(vo, NULL, vo->dx, vo->dy, vo->dwidth, + vo->dheight, flags, "xv"); - vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth, - vo->dheight, flags, CopyFromParent, "xv"); - XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa); - } + if (ctx->xv_ck_info.method == CK_METHOD_BACKGROUND) + XSetWindowBackground(x11->display, x11->window, ctx->xv_colorkey); mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n", ctx->xv_port); |