--- gdk/x11/xsettings-client.c.orig	2004-07-20 14:19:22.952397000 -0500
+++ gdk/x11/xsettings-client.c	2004-07-20 14:31:04.448904000 -0500
@@ -458,7 +458,9 @@
   XSettingsClient *client;
   char buffer[256];
   char *atom_names[3];
+#ifdef HAVE_XINTERNATOMS
   Atom atoms[3];
+#endif
   
   client = malloc (sizeof *client);
   if (!client)
@@ -480,11 +482,17 @@
   atom_names[1] = "_XSETTINGS_SETTINGS";
   atom_names[2] = "MANAGER";
 
+#ifdef HAVE_XINTERNATOMS
   XInternAtoms (display, atom_names, 3, False, atoms);
   
   client->selection_atom = atoms[0];
   client->xsettings_atom = atoms[1];
   client->manager_atom = atoms[2];
+#else
+  client->selection_atom = XInternAtom (display, atom_names[0], False);
+  client->xsettings_atom = XInternAtom (display, atom_names[1], False);
+  client->manager_atom = XInternAtom (display, atom_names[2], False);
+#endif
 
   /* Select on StructureNotify so we get MANAGER events
    */
--- gdk/x11/gdkproperty-x11.c.orig	2004-07-20 14:24:26.451366000 -0500
+++ gdk/x11/gdkproperty-x11.c	2004-07-20 14:30:32.497758000 -0500
@@ -228,8 +228,20 @@
     }
 
   if (n_xatoms)
+#ifdef HAVE_XINTERNATOMS
     XInternAtoms (GDK_DISPLAY_XDISPLAY (display),
 		  (char **)xatom_names, n_xatoms, False, xatoms);
+#else
+    {
+      gint j;
+
+      for (j = 0; j < n_xatoms; j++)
+        {
+          xatoms[j] = XInternAtom (GDK_DISPLAY_XDISPLAY (display),
+		                   xatom_names[j], False);
+        }
+    }
+#endif
 
   for (i = 0; i < n_xatoms; i++)
     insert_atom_pair (display, atoms[i], xatoms[i]);
--- gdk/x11/gdkasync.c.orig	2004-07-20 14:35:05.515439000 -0500
+++ gdk/x11/gdkasync.c	2004-07-20 14:48:21.310229000 -0500
@@ -44,6 +44,9 @@
 
 */
 #include <config.h>
+#ifdef NEED_XIPROTO_H_FOR_XREPLY
+#include <X11/extensions/XIproto.h>
+#endif
 #include <X11/Xlibint.h>
 #include "gdkasync.h"
 #include "gdkx.h"
--- configure.in.orig	2004-07-09 23:02:07.000000000 -0500
+++ configure.in	2004-07-20 14:59:20.103918000 -0500
@@ -1128,6 +1111,26 @@
 
   CPPFLAGS="$gtk_save_cppflags"
 
+  # Check for xReply
+
+  gtk_save_cppflags="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  AC_MSG_CHECKING([if <X11/extensions/XIproto.h> is needed for xReply])
+  AC_TRY_COMPILE([#include <X11/Xlibint.h>],
+      [xReply *rep;],
+      [AC_MSG_RESULT([no])],
+      [AC_TRY_COMPILE([#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>],
+           [xReply *rep;],
+           [AC_MSG_RESULT([yes])
+            AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], 1,
+                [Define if <X11/extensions/XIproto.h> needed for xReply])],
+           [AC_MSG_RESULT([unknown])
+            AC_MSG_ERROR([xReply type unavailable. X11 is too old])])])
+
+  CPPFLAGS="$gtk_save_cppflags"
+
   # Check for shaped window extension
 
   AC_CHECK_LIB(Xext, XShapeCombineMask,
@@ -1143,6 +1146,14 @@
       ,
       $x_libs_for_checks)
 
+  # Check for XInternAtoms (X11R6 specific)
+
+  AC_CHECK_LIB(X11, XInternAtoms,
+      AC_DEFINE([HAVE_XINTERNATOMS], 1,
+          [Define to 1 if you have the `XInternAtoms' function.]),
+      ,
+      $x_libs_for_checks)
+
   # Generic X11R6 check needed for XIM support; we could
   # probably use this to replace the above, but we'll
   # leave the separate XConvertCase check for clarity
