From b44bdfd20a4d025483d1bd5bdbfa1f7b829055f1 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 1 Feb 2011 20:47:22 +0100 Subject: [PATCH] winex11.drv: Only query for XShm on first use. --- dlls/winex11.drv/dib.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c index 05bd30cdf44..c7758e68b59 100644 --- a/dlls/winex11.drv/dib.c +++ b/dlls/winex11.drv/dib.c @@ -4728,6 +4728,24 @@ static XImage *X11DRV_XShmCreateImage( int width, int height, int bpp, } #endif /* HAVE_LIBXXSHM */ +static Bool X11DRV_DIB_QueryXShm( Bool *pixmaps ) +{ + static Bool have_xshm, have_xshm_pixmaps; + static BOOL initialized; + + if (!initialized) + { +#ifdef HAVE_LIBXXSHM + int major, minor; + + have_xshm = XShmQueryVersion( gdi_display, &major, &minor, &have_xshm_pixmaps ); +#endif + initialized = TRUE; + } + + *pixmaps = have_xshm_pixmaps; + return have_xshm; +} /*********************************************************************** * X11DRV_CreateDIBSection (X11DRV.@) @@ -4740,7 +4758,6 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, WORD bpp, compr; LONG w, h; #ifdef HAVE_LIBXXSHM - int major, minor; Bool pixmaps; #endif @@ -4780,7 +4797,7 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, #ifdef HAVE_LIBXXSHM physBitmap->shminfo.shmid = -1; - if (XShmQueryVersion( gdi_display, &major, &minor, &pixmaps ) + if (X11DRV_DIB_QueryXShm( &pixmaps ) && (physBitmap->image = X11DRV_XShmCreateImage( dib.dsBm.bmWidth, dib.dsBm.bmHeight, physBitmap->pixmap_depth, &physBitmap->shminfo ))) {