From e802bcb2e240c40c5e0a8fcf68f0c5a6f72fc262 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 24 Mar 2005 21:04:10 +0000 Subject: [PATCH] Try a TrueColor visual if Xrender fails with a DirectColor one. --- dlls/x11drv/init.c | 6 +++--- dlls/x11drv/xrender.c | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/x11drv/init.c b/dlls/x11drv/init.c index 71a9a6a0d5a..d7c6378c38b 100644 --- a/dlls/x11drv/init.c +++ b/dlls/x11drv/init.c @@ -97,13 +97,13 @@ void X11DRV_GDI_Initialize( Display *display ) { gdi_display = display; + /* Initialize XRender */ + X11DRV_XRender_Init(); + palette_size = X11DRV_PALETTE_Init(); X11DRV_BITMAP_Init(); - /* Initialize XRender */ - X11DRV_XRender_Init(); - /* Initialize device caps */ log_pixels_x = log_pixels_y = get_dpi(); horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 ); diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index 01f67b9e513..a45dbd01243 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -197,7 +197,22 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform) X11DRV_XRender_Installed = TRUE; TRACE("Xrender is up and running error_base = %d\n", error_base); screen_format = pXRenderFindVisualFormat(gdi_display, visual); - if(!screen_format) { /* This fails in buggy versions of libXrender.so */ + if(!screen_format) + { + /* Xrender doesn't like DirectColor visuals, try to find a TrueColor one instead */ + if (visual->class == DirectColor) + { + XVisualInfo info; + if (XMatchVisualInfo( gdi_display, DefaultScreen(gdi_display), + screen_depth, TrueColor, &info )) + { + screen_format = pXRenderFindVisualFormat(gdi_display, info.visual); + if (screen_format) visual = info.visual; + } + } + } + if(!screen_format) /* This fails in buggy versions of libXrender.so */ + { wine_tsx11_unlock(); WINE_MESSAGE( "Wine has detected that you probably have a buggy version\n"