From 470acf831f966a607ef6193b30a1f49d067a7cfa Mon Sep 17 00:00:00 2001
From: "Dimitrie O. Paun" <dimi@cs.toronto.edu>
Date: Sun, 26 Nov 2000 03:59:20 +0000
Subject: [PATCH] Do not compile code that makes use of the X Shm extension.

---
 graphics/x11drv/dib.c | 16 ++++++++++++++--
 include/x11drv.h      |  2 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c
index 4b15f856b28..fa86b78524b 100644
--- a/graphics/x11drv/dib.c
+++ b/graphics/x11drv/dib.c
@@ -3079,10 +3079,11 @@ INT X11DRV_DIB_GetDIBits(
   {
      descr.ySrc = startscan;
   }
-
+#ifdef HAVE_LIBXXSHM
   if (dib)
     descr.useShm = (dib->shminfo.shmid != -1);
   else
+#endif
     descr.useShm = FALSE;
 
   EnterCriticalSection( &X11DRV_CritSection );
@@ -3176,7 +3177,11 @@ static void X11DRV_DIB_DoUpdateDIBSection(BITMAPOBJ *bmp, BOOL toDIB)
   descr.yDest     = 0;
   descr.width     = bmp->bitmap.bmWidth;
   descr.height    = bmp->bitmap.bmHeight;
+#ifdef HAVE_LIBXXSHM
   descr.useShm = (dib->shminfo.shmid != -1);
+#else
+  descr.useShm = FALSE;
+#endif
 
   if (toDIB)
     {
@@ -3388,6 +3393,7 @@ static int XShmErrorHandler(Display *dpy, XErrorEvent *event)
  *
  */
 
+#ifdef HAVE_LIBXXSHM
 extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bpp,
 		                                   XShmSegmentInfo* shminfo)
 {
@@ -3435,7 +3441,7 @@ extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bp
     }
     return FALSE;
 }
-
+#endif /* HAVE_LIBXXSHM */
 
  
 
@@ -3557,6 +3563,7 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
   /* Create XImage */
   if (dib && bmp)
   {
+#ifdef HAVE_LIBXXSHM
       if (TSXShmQueryExtension(display) &&
           X11DRV_XShmCreateImage( &dib->image, bm.bmWidth, effHeight,
                                   bmp->bitmap.bmBitsPixel, &dib->shminfo ) )
@@ -3566,6 +3573,9 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
           XCREATEIMAGE( dib->image, bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel );
           dib->shminfo.shmid = -1;
       }
+#else
+      XCREATEIMAGE( dib->image, bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel );
+#endif
   }
   
   /* Clean up in case of errors */
@@ -3621,6 +3631,7 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp)
 
   if (dib->image) 
   {
+#ifdef HAVE_LIBXXSHM
       if (dib->shminfo.shmid != -1)
       {
           TSXShmDetach (display, &(dib->shminfo));
@@ -3629,6 +3640,7 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp)
           dib->shminfo.shmid = -1;
       }
       else
+#endif
           XDestroyImage( dib->image );
   }
   
diff --git a/include/x11drv.h b/include/x11drv.h
index 67a8bb4d3e2..fd0c5eef6f3 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -226,8 +226,10 @@ typedef struct
     /* Selector for 16-bit access to bits */
     WORD selector;
 
+#ifdef HAVE_LIBXXSHM
     /* Shared memory segment info */
     XShmSegmentInfo shminfo;
+#endif
 
 } X11DRV_DIBSECTION;
 
-- 
GitLab