[PATCH 2/2] winex11.drv: Only query for XShm on first use.

Henri Verbeet hverbeet at gmail.com
Tue Feb 1 13:47:22 CST 2011


---
 dlls/winex11.drv/dib.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 05bd30c..c7758e6 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 )))
     {
-- 
1.7.2.3




More information about the wine-patches mailing list