Blob Blame History Raw
diff -up xchat-2.8.4/src/fe-gtk/xtext.c.jx xchat-2.8.4/src/fe-gtk/xtext.c
--- xchat-2.8.4/src/fe-gtk/xtext.c.jx	2007-06-08 05:57:07.000000000 -0400
+++ xchat-2.8.4/src/fe-gtk/xtext.c	2007-12-20 17:12:52.000000000 -0500
@@ -3537,6 +3537,22 @@ get_image (GtkXText *xtext, Display *xdi
 
 #endif
 
+#ifdef USE_SHM
+static int
+have_shm_pixmaps(Display *dpy)
+{
+    static int checked = 0, major, minor;
+    static Bool have = FALSE;
+
+    if (!checked) {
+	XShmQueryVersion(dpy, &major, &minor, &have);
+	checked = 1;
+    }
+
+    return have;
+}
+#endif
+
 static GdkPixmap *
 shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
 {
@@ -3549,6 +3565,11 @@ shade_pixmap (GtkXText * xtext, Pixmap p
 	GC tgc;
 	Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
 
+#ifdef USE_SHM
+	int shm_pixmaps;
+	shm_pixmaps = have_shm_pixmaps(xdisplay);
+#endif
+
 	XGetGeometry (xdisplay, p, &root, &dummy, &dummy, &width, &height,
 					  &dummy, &depth);
 
@@ -3602,7 +3623,7 @@ shade_pixmap (GtkXText * xtext, Pixmap p
 	else
 	{
 #ifdef USE_SHM
-		if (xtext->shm)
+		if (xtext->shm && shm_pixmaps)
 		{
 #if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
 			shaded_pix = gdk_pixmap_foreign_new (
@@ -3620,7 +3641,7 @@ shade_pixmap (GtkXText * xtext, Pixmap p
 	}
 
 #ifdef USE_SHM
-	if (!xtext->shm)
+	if (!xtext->shm || !shm_pixmaps)
 #endif
 		XPutImage (xdisplay, GDK_WINDOW_XWINDOW (shaded_pix),
 					  GDK_GC_XGC (xtext->fgc), ximg, 0, 0, 0, 0, w, h);