From df80cd379ae2ea3fbbfd3f2a28e804b8882ea93a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 27 Jan 2013 12:01:08 +0100 Subject: 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". --- video/out/vo_xv.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'video/out/vo_xv.c') 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); -- cgit v1.2.3