diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c index 15d72da65..941cf2075 100644 --- a/src/x11/iconcache.c +++ b/src/x11/iconcache.c @@ -288,34 +288,12 @@ get_pixmap_geometry (MetaX11Display *x11_display, *d = depth; } -static int -standard_pict_format_for_depth (int depth) -{ - switch (depth) - { - case 1: - return PictStandardA1; - case 24: - return PictStandardRGB24; - case 32: - return PictStandardARGB32; - default: - g_assert_not_reached (); - } - return 0; -} - -static XRenderPictFormat * -pict_format_for_depth (Display *xdisplay, int depth) -{ - return XRenderFindStandardFormat (xdisplay, standard_pict_format_for_depth (depth)); -} - static cairo_surface_t * surface_from_pixmap (Display *xdisplay, Pixmap xpixmap, int width, int height) { Window root_return; + XVisualInfo visual_info; int x_ret, y_ret; unsigned int w_ret, h_ret, bw_ret, depth_ret; @@ -323,8 +301,12 @@ surface_from_pixmap (Display *xdisplay, Pixmap xpixmap, &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) return NULL; - return cairo_xlib_surface_create_with_xrender_format (xdisplay, xpixmap, DefaultScreenOfDisplay (xdisplay), - pict_format_for_depth (xdisplay, depth_ret), w_ret, h_ret); + if (!XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay), + depth_ret, TrueColor, &visual_info)) + return NULL; + + return cairo_xlib_surface_create (xdisplay, xpixmap, visual_info.visual, + w_ret, h_ret); } static gboolean