Henri Verbeet : winex11.drv: Only query for XShm on first use.

Alexandre Julliard julliard at winehq.org
Wed Feb 2 12:30:15 CST 2011


Module: wine
Branch: master
Commit: b44bdfd20a4d025483d1bd5bdbfa1f7b829055f1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b44bdfd20a4d025483d1bd5bdbfa1f7b829055f1

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Tue Feb  1 20:47:22 2011 +0100

winex11.drv: Only query for XShm on first use.

---

 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 )))
     {




More information about the wine-cvs mailing list