Separating GdkAtom and Atom



Havoc pointed out to me (Bug #62208) that we really need to 
go ahead and do the atom virtualization before 2.0 if we
want to make a compatible transition to 2.2. 

The idea of atom virtualization is that a GdkAtom is a client-side
object, similar to a GQuark, and then these atoms are mapped
into the appropriate Atom's for each display.

In the GTK+ multihead branch, the mapping is done with the
functions:

GdkAtom     gdk_x11_get_real_atom         (GdkDisplay  *display,
					   GdkAtom      virtual_atom);
GdkAtom     gdk_x11_get_virtual_atom      (GdkDisplay  *display,
					   GdkAtom      xatom);
GdkAtom     gdk_x11_get_real_atom_by_name (GdkDisplay  *display,
					   const gchar *atom_name);
gchar	   *gdk_x11_get_real_atom_name    (GdkDisplay  *display,
				           GdkAtom      xatom);

For programs that are pure GDK, there is no compatibility
problems. However, there are significant numbers of programs that mix
GDK and and Xlib, and such programs assume equivalence between GdkAtom
and Atom.

So, we need to add functions to GTK+-2.0 to do the same operations,
but in a "using the default display" manner. These functions will be
protected with #ifndef GDK_MULTIHEAD_SAFE in GTK+-2.2. The names I
have currently are:

 Atom    gdk_x11_atom_to_xatom     (GdkAtom      atom);
 GdkAtom gdk_x11_xatom_to_atom     (Atom         xatom);
 Atom    gdk_x11_get_xatom_by_name (const gchar *atom_name);
 gchar * gdk_x11_get_xatom_name    (Atom         xatom);

I actually like these names considerably better than the
multihead-branch names, because it's hard for me to keep straight what
is the "real" atom, and what the "virtual" atom.

But it is rather confusing to use unrelated names for the
same operations depending on whether there is a GdkDisplay
parameter or not.

So, we probably should pick one of the following schemes:

 gdk_x11_default_atom_to_xatom (GdkAtom atom);
 gdk_x11_atom_to_xatom (GdkDisplay *display, Atom atom);
 
 gdk_x11_atom_to_xatom (GdkAtom atom);
 gdk_x11_display_atom_to_xatom (GdkDisplay *display, GdkAtom atom);
 
 gdk_x11_atom_to_xatom (GdkAtom atom);
 gdk_x11_atom_to_xatom_for_display (GdkDisplay *display, GdkAtom atom);

To implement these functions, what I did was take the virtualized
atom code from gtk-multihead and replace the two hash tables 
stored in the GdkDisplay with static variables.

Two other possibilities for implementation existed:

 - Make gdk_x11_atom_to_xatom a straight pass-through; this
   solves, in theory, the problem of conversion of code
   to virtualized atoms in 2.2, but if we don't cause actual
   breakage in 2.0, I doubt people will bother to fix their
   code.

 - Make gdk_x11_atom_to_xatom() a simpler transformation - 
   say add 1 to the X Atom to get the GDK atom. This is
   certainly possible, and "as good". But it's not 
   signicantly less code, so the only real advantage
   is a small optimization (less lookups) that we would
   loose in GTK+-2.2 anyways.

With the code to implement virtual GdkAtoms in hand, I started
looking at converting the code in GDK and GTK+ to properly
use atoms. Even having Erwann's work in gtk-multihead
as comparison point, it didn't look like a fun job.
(I started off doing plug and socket in GTK+ and immediately
found a couple of places where the conversion was missing
in gtk-multihead.)

Clearly, things would be much easier if the compiler caught
missing conversions. So, as a debugging aid, I did:

 typedef struct _GdkAtom      *GdkAtom;
 #define _GDK_MAKE_ATOM(val)   ((GdkAtom)GUINT_TO_POINTER(val))
 #define GDK_NONE              _GDK_MAKE_ATOM (0)
 #define GDK_SELECTION_PRIMARY _GDK_MAKE_ATOM(1)

Unfortunately, you can't have distinguished integer typedefs
in C, so using a pointer type is necessary. A one-element
by-value struct would also be possible, but I don't really
trust compilers to generate as good code that way.

This really made converting over GDK a breeze, and I have
a lot more confidence in the result than I would otherwise.

The incompatibilities with existing code of doing the above
are:

 - You can't switch over GdkAtom any more. This isn't much
   of a problem, since the only enum types that you could
   switch over were the predefined ones, and there weren't
   enough of those to make a switch statement useful.

 - Code that converted pointers <=> atoms using
   GPOINTER_TO_UINT. This is reasonably common (a dozen or
   so places in GTK+) because you have to do it to
   use GdkDragContext->targets. What a bad idea it was
   not to make that an array.

   To deal with this, I added macros:

    #define GDK_ATOM_TO_POINTER(atom) (atom)
    #define GDK_POINTER_TO_ATOM(ptr)  ((GdkAtom)(ptr))

 - You can't store GdkAtom's in Atom variables or vice-versa.

 - You can't mix the #defines from Xatom.h with the
   GTK+ predefined atom values. Easy enough to fix up
   where there are problems. (Most problems that showed
   up in GDK were with GDK_NONE uses that had to be
   changed to None.)

 - The GdkSelection, GdkTarget, and GdkSelectionType enumerations
   disappear or become typedefs for GdkAtom. But these
   types were unused in GDK/GTK+ and probably elsewhere as
   well, so this isnt' much of a pain. They were always
   a bit funny since they were missing most of the atoms
   that you actually needed to use.

I originally planned to just do this as a transition measure
turned on with a #define and switch back to the standard gulong define
later, but on consideration I think it's  better to keep it this
way. 

 - It will catch bugs of this type automatically in future
   GDK modifications.
 
 - People developing other apps using mixed GDK and Xlib are
   not going to bother to recompile GDK, especially since
   the recompiled GDK is not totally source compat with the 
   standard GDK. (it will be bin compat on platforms where
   sizeof(long) == sizeof(void *).)

 - The source incompatibilities listed above are going to 
   be a lot less of a pain for people to deal with than
   obscure bugs where the wrong atom values are being used.

Remaining TODO here is:

 - Finalize the naming scheme
 - Decide if we want to keep the 'typedef GdkAtom gulong' option,
   and if not, clean things up by removing it.
 - Add docs for the new functions and macros.
 - Write a Changes-2.0.txt entry. 

Regards,
                                        Owen

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2404
diff -u -r1.2404 ChangeLog
--- ChangeLog	2001/10/20 01:39:16	1.2404
+++ ChangeLog	2001/10/20 17:22:25
@@ -1,3 +1,19 @@
+Sat Oct 20 13:10:09 2001  Owen Taylor  <otaylor redhat com>
+
+	* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
+	problem with g_return_if_fail return value.
+
+Fri Oct 19 16:31:35 2001  Owen Taylor  <otaylor redhat com>
+ 
+ 	* gdk/x11/gdkproperty-x11.c (gdk_x11_xatom_to_atom): Move
+ 	over the virtual atom code from the gdk-multihead branch,
+ 	removing the per-display part. Virtualizing atoms needs
+ 	to be done now to prevent compat breakage in direct
+ 	Xlib accessing code in the future. (#62208)
+ 
+ 	* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty.h: Export
+ 	gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
+ 
 Fri Oct 19 18:35:22 2001  Manish Singh  <yosh gimp org>
 
 	* gtk/{gtkentry.c,gtktextview.c}: since GtkIMContext derives directly
Index: gdk/gdkselection.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkselection.h,v
retrieving revision 1.2
diff -u -r1.2 gdkselection.h
--- gdk/gdkselection.h	2000/03/14 19:57:22	1.2
+++ gdk/gdkselection.h	2001/10/20 17:22:27
@@ -7,6 +7,25 @@
 extern "C" {
 #endif /* __cplusplus */
 
+#ifdef GDK_POINTER_ATOMS
+
+#define GDK_SELECTION_PRIMARY 		_GDK_MAKE_ATOM(1)
+#define GDK_SELECTION_SECONDARY 	_GDK_MAKE_ATOM(1)
+#define GDK_TARGET_BITMAP 		_GDK_MAKE_ATOM (5)
+#define GDK_TARGET_COLORMAP 		_GDK_MAKE_ATOM (7)
+#define GDK_TARGET_DRAWABLE 		_GDK_MAKE_ATOM (17)
+#define GDK_TARGET_PIXMAP 		_GDK_MAKE_ATOM (20)
+#define GDK_TARGET_STRING 		_GDK_MAKE_ATOM (3)
+#define GDK_SELECTION_TYPE_ATOM 	_GDK_MAKE_ATOM (4)
+#define GDK_SELECTION_TYPE_BITMAP 	_GDK_MAKE_ATOM (5)
+#define GDK_SELECTION_TYPE_COLORMAP 	_GDK_MAKE_ATOM (7)
+#define GDK_SELECTION_TYPE_DRAWABLE 	_GDK_MAKE_ATOM (17)
+#define GDK_SELECTION_TYPE_INTEGER 	_GDK_MAKE_ATOM (19)
+#define GDK_SELECTION_TYPE_PIXMAP 	_GDK_MAKE_ATOM (20)
+#define GDK_SELECTION_TYPE_WINDOW 	_GDK_MAKE_ATOM (33)
+#define GDK_SELECTION_TYPE_STRING 	_GDK_MAKE_ATOM (3)
+
+#else /* !GDK_POINTER_ATOMS */
 /* The next three types define enums for predefined atoms relating
    to selections. In general, one will need to use gdk_intern_atom */
 
@@ -36,6 +55,7 @@
   GDK_SELECTION_TYPE_WINDOW = 33,
   GDK_SELECTION_TYPE_STRING = 31
 } GdkSelectionType;
+#endif
 
 /* Selections
  */
Index: gdk/gdktypes.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdktypes.h,v
retrieving revision 1.59
diff -u -r1.59 gdktypes.h
--- gdk/gdktypes.h	2001/09/19 00:58:09	1.59
+++ gdk/gdktypes.h	2001/10/20 17:22:27
@@ -51,7 +51,6 @@
 #include <gdkconfig.h>
 
 /* some common magic values */
-#define GDK_NONE	     0L
 #define GDK_CURRENT_TIME     0L
 #define GDK_PARENT_RELATIVE  1L
 
@@ -76,7 +75,21 @@
  * on Win32, wchar_t is unsigned short.
  */
 typedef guint32			    GdkWChar;
+
+#define GDK_POINTER_ATOMS
+
+#ifdef GDK_POINTER_ATOMS
+typedef struct _GdkAtom            *GdkAtom;
+#define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
+#define GDK_ATOM_TO_POINTER(atom) (atom)
+#define GDK_POINTER_TO_ATOM(ptr)  ((GdkAtom)(ptr))
+#define GDK_NONE             _GDK_MAKE_ATOM (0)
+#else
 typedef gulong     		    GdkAtom;
+#define GDK_NONE	     0L
+#define GDK_ATOM_TO_POINTER(atom) (GUINT_TO_POINTER(atom))
+#define GDK_POINTER_TO_ATOM(ptr)  ((GdkAtom)GPOINTER_TO_UINT(ptr))
+#endif
 
 #ifdef GDK_NATIVE_WINDOW_POINTER
 typedef gpointer GdkNativeWindow;
Index: gdk/x11/gdkproperty-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkproperty-x11.c,v
retrieving revision 1.21
diff -u -r1.21 gdkproperty-x11.c
--- gdk/x11/gdkproperty-x11.c	2001/09/07 21:50:09	1.21
+++ gdk/x11/gdkproperty-x11.c	2001/10/20 17:22:29
@@ -28,69 +28,238 @@
 #include <X11/Xatom.h>
 #include <string.h>
 
+#include "gdk.h"          /* For gdk_error_trap_push/pop() */
 #include "gdkx.h"
 #include "gdkproperty.h"
 #include "gdkprivate.h"
 
-GdkAtom
-gdk_atom_intern (const gchar *atom_name,
-		 gboolean     only_if_exists)
+static GPtrArray *virtual_atom_array;
+static GHashTable *virtual_atom_hash;
+static GHashTable *atom_to_virtual;
+static GHashTable *atom_from_virtual;
+
+static gchar *XAtomsStrings[] = {
+  "NONE",
+  "PRIMARY",
+  "SECONDARY",
+  "ARC",
+  "ATOM",
+  "BITMAP",
+  "CARDINAL",
+  "COLORMAP",
+  "CURSOR",
+  "CUT_BUFFER0",
+  "CUT_BUFFER1",
+  "CUT_BUFFER2",
+  "CUT_BUFFER3",
+  "CUT_BUFFER4",
+  "CUT_BUFFER5",
+  "CUT_BUFFER6",
+  "CUT_BUFFER7",
+  "DRAWABLE",
+  "FONT",
+  "INTEGER",
+  "PIXMAP",
+  "POINT",
+  "RECTANGLE",
+  "RESOURCE_MANAGER",
+  "RGB_COLOR_MAP",
+  "RGB_BEST_MAP",
+  "RGB_BLUE_MAP",
+  "RGB_DEFAULT_MAP",
+  "RGB_GRAY_MAP",
+  "RGB_GREEN_MAP",
+  "RGB_RED_MAP",
+  "STRING",
+  "VISUALID",
+  "WINDOW",
+  "WM_COMMAND",
+  "WM_HINTS",
+  "WM_CLIENT_MACHINE",
+  "WM_ICON_NAME",
+  "WM_ICON_SIZE",
+  "WM_NAME",
+  "WM_NORMAL_HINTS",
+  "WM_SIZE_HINTS",
+  "WM_ZOOM_HINTS",
+  "MIN_SPACE",
+  "NORM_SPACE",
+  "MAX_SPACE",  "END_SPACE",
+  "SUPERSCRIPT_X",
+  "SUPERSCRIPT_Y",
+  "SUBSCRIPT_X",
+  "SUBSCRIPT_Y",
+  "UNDERLINE_POSITION",
+  "UNDERLINE_THICKNESS",
+  "STRIKEOUT_ASCENT",
+  "STRIKEOUT_DESCENT",
+  "ITALIC_ANGLE",
+  "X_HEIGHT",
+  "QUAD_WIDTH",
+  "WEIGHT",
+  "POINT_SIZE",
+  "RESOLUTION",
+  "COPYRIGHT",
+  "NOTICE",
+  "FONT_NAME",
+  "FAMILY_NAME",
+  "FULL_NAME",
+  "CAP_HEIGHT",
+  "WM_CLASS",
+  "WM_TRANSIENT_FOR"
+};
+
+#ifdef GDK_POINTER_ATOMS
+#define ATOM_TO_INDEX(atom) (GPOINTER_TO_UINT(atom))
+#define INDEX_TO_ATOM(atom) ((GdkAtom)GUINT_TO_POINTER(atom))
+#else  
+#define ATOM_TO_INDEX(atom) ((guint)atom)
+#define INDEX_TO_ATOM(atom) ((GdkAtom)atom)
+#endif  
+
+void
+insert_atom_pair (GdkAtom     virtual_atom,
+		  Atom        xatom)
 {
-  GdkAtom retval;
-  static GHashTable *atom_hash = NULL;
+  if (!atom_from_virtual)
+    {
+      atom_from_virtual = g_hash_table_new (g_direct_hash, NULL);
+      atom_to_virtual = g_hash_table_new (g_direct_hash, NULL);
+    }
   
-  g_return_val_if_fail (atom_name != NULL, GDK_NONE);
-
-  if (!atom_hash)
-    atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
+  g_hash_table_insert (atom_from_virtual, 
+		       GDK_ATOM_TO_POINTER (virtual_atom), GUINT_TO_POINTER (xatom));
+  g_hash_table_insert (atom_to_virtual,
+		       GUINT_TO_POINTER (xatom), GDK_ATOM_TO_POINTER (virtual_atom));
+}
 
-  retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
-  if (!retval)
+Atom
+gdk_x11_atom_to_xatom (GdkAtom virtual_atom)
+{
+  Atom xatom = None;
+  
+  if (ATOM_TO_INDEX (virtual_atom) < G_N_ELEMENTS (XAtomsStrings))
+    return ATOM_TO_INDEX (virtual_atom);
+  
+  if (atom_from_virtual)
+    xatom = GPOINTER_TO_UINT (g_hash_table_lookup (atom_from_virtual,
+						   GDK_ATOM_TO_POINTER (virtual_atom)));
+  if (!xatom)
     {
-      retval = XInternAtom (gdk_display, atom_name, only_if_exists);
+      char *name;
+      
+      g_return_val_if_fail (ATOM_TO_INDEX (virtual_atom) < virtual_atom_array->len, None);
 
-      if (retval != None)
-	g_hash_table_insert (atom_hash, 
-			     g_strdup (atom_name), 
-			     GUINT_TO_POINTER (retval));
+      name = g_ptr_array_index (virtual_atom_array, ATOM_TO_INDEX (virtual_atom));
+      
+      xatom = XInternAtom (gdk_display, name, FALSE);
+      insert_atom_pair (virtual_atom, xatom);
     }
 
-  return retval;
+  return xatom;
 }
 
-gchar*
-gdk_atom_name (GdkAtom atom)
+GdkAtom
+gdk_x11_xatom_to_atom (Atom xatom)
 {
-  gchar *t;
-  gchar *name;
-  gint old_error_warnings;
-
-  /* If this atom doesn't exist, we'll die with an X error unless
-     we take precautions */
+  GdkAtom virtual_atom = GDK_NONE;
+  
+  if (xatom < G_N_ELEMENTS (XAtomsStrings))
+    return INDEX_TO_ATOM (xatom);
+  
+  if (atom_to_virtual)
+    virtual_atom = GDK_POINTER_TO_ATOM (g_hash_table_lookup (atom_to_virtual,
+							     GUINT_TO_POINTER (xatom)));
+  
+  if (!virtual_atom)
+    {
+      /* If this atom doesn't exist, we'll die with an X error unless
+       * we take precautions
+       */
+      char *name;
+      gdk_error_trap_push ();
+      name = XGetAtomName (gdk_display, xatom);
+      if (gdk_error_trap_pop ())
+	{
+	  g_warning (G_STRLOC " invalid X atom: %ld", xatom);
+	}
+      else
+	{
+	  virtual_atom = gdk_atom_intern (name, FALSE);
+	  XFree (name);
+	  
+	  insert_atom_pair (virtual_atom, xatom);
+	}
+    }
 
-  old_error_warnings = _gdk_error_warnings;
-  _gdk_error_warnings = 0;
-  _gdk_error_code = 0;
-  t = XGetAtomName (gdk_display, atom);
-  _gdk_error_warnings = old_error_warnings;
+  return virtual_atom;
+}
 
-  if (_gdk_error_code)
+static void
+virtual_atom_check_init (void)
+{
+  if (!virtual_atom_hash)
     {
-      if (t)
-	XFree (t);
-
-      return NULL;
+      gint i;
+      
+      virtual_atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
+      virtual_atom_array = g_ptr_array_new ();
+      
+      for (i = 0; i < G_N_ELEMENTS (XAtomsStrings); i++)
+	{
+	  g_ptr_array_add (virtual_atom_array, XAtomsStrings[i]);
+	  g_hash_table_insert (virtual_atom_hash, XAtomsStrings[i],
+			       GUINT_TO_POINTER (i));
+	}
     }
-  else
+}
+
+GdkAtom
+gdk_atom_intern (const gchar *atom_name, 
+		 gboolean     only_if_exists)
+{
+  GdkAtom result;
+
+  virtual_atom_check_init ();
+  
+  result = GDK_POINTER_TO_ATOM (g_hash_table_lookup (virtual_atom_hash, atom_name));
+  if (!result)
     {
-      name = g_strdup (t);
-      if (t)
-	XFree (t);
+      result = INDEX_TO_ATOM (virtual_atom_array->len);
       
-      return name;
+      g_ptr_array_add (virtual_atom_array, g_strdup (atom_name));
+      g_hash_table_insert (virtual_atom_hash, 
+			   g_ptr_array_index (virtual_atom_array,
+					      ATOM_TO_INDEX (result)),
+			   GDK_ATOM_TO_POINTER (result));
     }
+
+  return result;
 }
 
+gchar *
+gdk_atom_name (GdkAtom atom)
+{
+  virtual_atom_check_init ();
+
+  if (ATOM_TO_INDEX (atom) < virtual_atom_array->len)
+    return g_strdup (g_ptr_array_index (virtual_atom_array, ATOM_TO_INDEX (atom)));
+  else
+    return NULL;
+}
+
+Atom
+gdk_x11_get_xatom_by_name (const gchar *atom_name)
+{
+  return gdk_x11_atom_to_xatom (gdk_atom_intern (atom_name, FALSE));
+}
+
+gchar *
+gdk_x11_get_xatom_name (Atom xatom)
+{
+  return gdk_atom_name (gdk_x11_xatom_to_atom (xatom));
+}
+
 gboolean
 gdk_property_get (GdkWindow   *window,
 		  GdkAtom      property,
Index: gdk/x11/gdkx.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkx.h,v
retrieving revision 1.27
diff -u -r1.27 gdkx.h
--- gdk/x11/gdkx.h	2001/10/18 20:23:16	1.27
+++ gdk/x11/gdkx.h	2001/10/20 17:22:30
@@ -112,6 +112,11 @@
 /* returns TRUE if we support the given WM spec feature */
 gboolean      gdk_net_wm_supports      (GdkAtom property);
 
+Atom    gdk_x11_atom_to_xatom     (GdkAtom      atom);
+GdkAtom gdk_x11_xatom_to_atom     (Atom         xatom);
+Atom    gdk_x11_get_xatom_by_name (const gchar *atom_name);
+gchar * gdk_x11_get_xatom_name    (Atom         xatom);
+
 #ifndef GDK_DISABLE_DEPRECATED
 
 Display *            gdk_x11_font_get_xdisplay (GdkFont *font);
Index: gdk/x11/gdkdnd-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkdnd-x11.c,v
retrieving revision 1.41
diff -u -r1.41 gdkdnd-x11.c
--- gdk/x11/gdkdnd-x11.c	2001/09/07 21:50:09	1.41
+++ gdk/x11/gdkdnd-x11.c	2001/10/20 17:22:28
@@ -61,8 +61,8 @@
 struct _GdkDragContextPrivateX11 {
   GdkDragContext context;
 
-  GdkAtom motif_selection;
-  GdkAtom xdnd_selection;
+  Atom motif_selection;
+  Atom xdnd_selection;
   guint   ref_count;
 
   guint16 last_x;		/* Coordinates from last event */
@@ -489,7 +489,7 @@
   static Atom wm_state_atom = None;
 
   if (!wm_state_atom)
-    wm_state_atom = gdk_atom_intern ("WM_STATE", FALSE);
+    wm_state_atom = gdk_x11_get_xatom_by_name ("WM_STATE");
     
   XGetWindowProperty (gdk_display, win, 
 		      wm_state_atom, 0, 0, False, AnyPropertyType,
@@ -616,7 +616,7 @@
   static Atom wm_state_atom = None;
 
   if (!wm_state_atom)
-    wm_state_atom = gdk_atom_intern ("WM_STATE", FALSE);
+    wm_state_atom = gdk_x11_get_xatom_by_name ("WM_STATE");
     
   XGetWindowProperty (gdk_display, win, 
 		      wm_state_atom, 0, 0, False, AnyPropertyType,
@@ -768,7 +768,7 @@
 {
   while (targets)
     {
-      gchar *name = gdk_atom_name (GPOINTER_TO_INT (targets->data));
+      gchar *name = gdk_atom_name (GDK_POINTER_TO_ATOM (targets->data));
       g_message ("\t%s", name);
       g_free (name);
       targets = targets->next;
@@ -851,8 +851,8 @@
 static Window motif_drag_window = None;
 static GdkWindow *motif_drag_gdk_window = NULL;
 
-static GdkAtom motif_drag_targets_atom = GDK_NONE;
-static GdkAtom motif_drag_receiver_info_atom = GDK_NONE;
+static Atom motif_drag_targets_atom = None;
+static Atom motif_drag_receiver_info_atom = None;
 
 /* Target table handling */
 
@@ -879,14 +879,14 @@
   return GDK_FILTER_REMOVE;
 }
 
-static Atom motif_drag_window_atom = GDK_NONE;
+static Atom motif_drag_window_atom = None;
 
 static Window
 motif_lookup_drag_window (Display *display)
 {
   Window retval = None;
   gulong bytes_after, nitems;
-  GdkAtom type;
+  Atom type;
   gint format;
   guchar *data;
 
@@ -917,7 +917,7 @@
   if (!motif_drag_window)
     {
       if (!motif_drag_window_atom)
-	motif_drag_window_atom = gdk_atom_intern ("_MOTIF_DRAG_WINDOW", TRUE);
+	motif_drag_window_atom = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_WINDOW");
 
       motif_drag_window = motif_lookup_drag_window (gdk_display);
       
@@ -977,12 +977,12 @@
 motif_read_target_table (void)
 {
   gulong bytes_after, nitems;
-  GdkAtom type;
+  Atom type;
   gint format;
   gint i, j;
 
   if (!motif_drag_targets_atom)
-    motif_drag_targets_atom = gdk_atom_intern ("_MOTIF_DRAG_TARGETS", FALSE);
+    motif_drag_targets_atom = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_TARGETS");
 
   if (motif_target_lists)
     {
@@ -1117,7 +1117,7 @@
 }
 
 static gint
-motif_add_to_target_table (GList *targets)
+motif_add_to_target_table (GList *targets) /* targets is list of GdkAtom */
 {
   GList *sorted = NULL;
   gint index = -1;
@@ -1128,7 +1128,8 @@
   
   while (targets)
     {
-      sorted = g_list_insert_sorted (sorted, targets->data, targets_sort_func);
+      Atom xatom = gdk_x11_atom_to_xatom (GDK_POINTER_TO_ATOM (targets->data));
+      sorted = g_list_insert_sorted (sorted, GUINT_TO_POINTER (xatom), targets_sort_func);
       targets = targets->next;
     }
 
@@ -1304,10 +1305,10 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
   MotifDragInitiatorInfo info;
   gint i;
-  static GdkAtom motif_drag_initiator_info = GDK_NONE;
+  static Atom motif_drag_initiator_info = None;
 
   if (!motif_drag_initiator_info)
-    motif_drag_initiator_info = gdk_atom_intern ("_MOTIF_DRAG_INITIATOR_INFO", FALSE);
+    motif_drag_initiator_info = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_INITIATOR_INFO");
 
   info.byte_order = local_byte_order;
   info.protocol_version = 0;
@@ -1319,7 +1320,7 @@
       gchar buf[20];
       g_snprintf(buf, 20, "_GDK_SELECTION_%d", i);
       
-      private->motif_selection = gdk_atom_intern (buf, FALSE);
+      private->motif_selection = gdk_x11_get_xatom_by_name (buf);
       if (!XGetSelectionOwner (gdk_display, private->motif_selection))
 	break;
     }
@@ -1345,7 +1346,7 @@
   unsigned long nitems, after;
 
   if (!motif_drag_receiver_info_atom)
-    motif_drag_receiver_info_atom = gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE);
+    motif_drag_receiver_info_atom = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_RECEIVER_INFO");
 
   gdk_error_trap_push ();
   XGetWindowProperty (gdk_display, win, 
@@ -1376,8 +1377,7 @@
 	}
     }
 
-  return retval ? win : GDK_NONE;
-  
+  return retval ? win : None;
 }
 
 static void
@@ -1388,7 +1388,7 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
   xev.xclient.format = 8;
   xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
 
@@ -1417,7 +1417,7 @@
   XEvent xev;
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
   xev.xclient.format = 8;
   xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
 
@@ -1447,7 +1447,7 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
   xev.xclient.format = 8;
   xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
 
@@ -1490,7 +1490,7 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
   xev.xclient.format = 8;
   xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
 
@@ -1515,14 +1515,14 @@
 /* Target Side */
 
 static gboolean
-motif_read_initiator_info (Window source_window, 
-			   Atom atom,
-			   GList  **targets,
-			   GdkAtom *selection)
+motif_read_initiator_info (Window   source_window, 
+			   Atom     atom,
+			   GList  **targets, /* GdkAtom */
+			   Atom    *selection)
 {
   GList *tmp_list;
-  static GdkAtom motif_drag_initiator_info = GDK_NONE;
-  GdkAtom type;
+  static Atom motif_drag_initiator_info = None;
+  Atom type;
   gint format;
   gulong nitems;
   gulong bytes_after;
@@ -1530,7 +1530,7 @@
   MotifDragInitiatorInfo *initiator_info;
 
   if (!motif_drag_initiator_info)
-    motif_drag_initiator_info = gdk_atom_intern ("_MOTIF_DRAG_INITIATOR_INFO", FALSE);
+    motif_drag_initiator_info = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_INITIATOR_INFO");
 
   gdk_error_trap_push ();
   XGetWindowProperty (gdk_display, source_window, atom,
@@ -1564,8 +1564,8 @@
   *targets = NULL;
   while (tmp_list)
     {
-      *targets = g_list_prepend (*targets,
-				 tmp_list->data);
+      GdkAtom atom = gdk_x11_xatom_to_atom (GPOINTER_TO_UINT (tmp_list->data));
+      *targets = g_list_prepend (*targets, GDK_ATOM_TO_POINTER (atom));
       tmp_list = tmp_list->prev;
     }
 
@@ -1627,10 +1627,10 @@
   gdk_window_ref (dest_window);
   new_context->start_time = timestamp;
 
-  if (!motif_read_initiator_info(source_window,
-				 atom,
-				 &new_context->targets,
-				 &private->motif_selection))
+  if (!motif_read_initiator_info (source_window,
+				  atom,
+				  &new_context->targets,
+				  &private->motif_selection))
     {
       gdk_drag_context_unref (new_context);
       return NULL;
@@ -1868,7 +1868,7 @@
   guint16 flags;
   guint32 timestamp;
   guint32 source_window;
-  GdkAtom atom;
+  Atom atom;
   gint16 x_root, y_root;
   gboolean is_reply;
   
@@ -1942,14 +1942,14 @@
 
 static struct {
   gchar *name;
-  GdkAtom atom;
+  Atom atom;
   GdkDragAction action;
 } xdnd_actions_table[] = {
-    { "XdndActionCopy",    GDK_NONE, GDK_ACTION_COPY },
-    { "XdndActionMove",    GDK_NONE, GDK_ACTION_MOVE },
-    { "XdndActionLink",    GDK_NONE, GDK_ACTION_LINK },
-    { "XdndActionAsk",     GDK_NONE, GDK_ACTION_ASK  },
-    { "XdndActionPrivate", GDK_NONE, GDK_ACTION_COPY },
+    { "XdndActionCopy",    None, GDK_ACTION_COPY },
+    { "XdndActionMove",    None, GDK_ACTION_MOVE },
+    { "XdndActionLink",    None, GDK_ACTION_LINK },
+    { "XdndActionAsk",     None, GDK_ACTION_ASK  },
+    { "XdndActionPrivate", None, GDK_ACTION_COPY },
   };
 
 static const gint xdnd_n_actions = sizeof(xdnd_actions_table) / sizeof(xdnd_actions_table[0]);
@@ -1962,11 +1962,11 @@
   
   xdnd_actions_initialized = TRUE;
   for (i=0; i < xdnd_n_actions; i++)
-    xdnd_actions_table[i].atom = gdk_atom_intern (xdnd_actions_table[i].name, FALSE);
+    xdnd_actions_table[i].atom = gdk_x11_get_xatom_by_name (xdnd_actions_table[i].name);
 }
 
 static GdkDragAction
-xdnd_action_from_atom (GdkAtom atom)
+xdnd_action_from_atom (Atom atom)
 {
   gint i;
 
@@ -1980,7 +1980,7 @@
   return 0;
 }
 
-static GdkAtom
+static Atom
 xdnd_action_to_atom (GdkDragAction action)
 {
   gint i;
@@ -1992,10 +1992,10 @@
     if (action == xdnd_actions_table[i].action)
       return xdnd_actions_table[i].atom;
 
-  return GDK_NONE;
+  return None;
 }
 
-static GdkAtom xdnd_aware_atom = GDK_NONE;
+static Atom xdnd_aware_atom = None;
 
 /* Source side */
 
@@ -2007,7 +2007,7 @@
   XEvent *xevent = (XEvent *)xev;
   guint32 dest_window = xevent->xclient.data.l[0];
   guint32 flags = xevent->xclient.data.l[1];
-  GdkAtom action = xevent->xclient.data.l[4];
+  Atom action = xevent->xclient.data.l[4];
   GdkDragContext *context;
   
   GDK_NOTE (DND, 
@@ -2072,23 +2072,23 @@
 xdnd_set_targets (GdkDragContext *context)
 {
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
-  GdkAtom *atomlist;
+  Atom *atomlist;
   GList *tmp_list = context->targets;
   gint i;
   gint n_atoms = g_list_length (context->targets);
 
-  atomlist = g_new (GdkAtom, n_atoms);
+  atomlist = g_new (Atom, n_atoms);
   i = 0;
   while (tmp_list)
     {
-      atomlist[i] = GPOINTER_TO_INT (tmp_list->data);
+      atomlist[i] = gdk_x11_atom_to_xatom (GDK_POINTER_TO_ATOM (tmp_list->data));
       tmp_list = tmp_list->next;
       i++;
     }
 
   XChangeProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
 		   GDK_DRAWABLE_XID (context->source_window),
-		   gdk_atom_intern ("XdndTypeList", FALSE),
+		   gdk_x11_get_xatom_by_name ("XdndTypeList"),
 		   XA_ATOM, 32, PropModeReplace,
 		   (guchar *)atomlist, n_atoms);
 
@@ -2101,7 +2101,7 @@
 xdnd_set_actions (GdkDragContext *context)
 {
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
-  GdkAtom *atomlist;
+  Atom *atomlist;
   gint i;
   gint n_atoms;
   guint actions;
@@ -2120,7 +2120,7 @@
 	}
     }
 
-  atomlist = g_new (GdkAtom, n_atoms);
+  atomlist = g_new (Atom, n_atoms);
 
   actions = context->actions;
   n_atoms = 0;
@@ -2136,7 +2136,7 @@
 
   XChangeProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
 		   GDK_DRAWABLE_XID (context->source_window),
-		   gdk_atom_intern ("XdndActionList", FALSE),
+		   gdk_x11_get_xatom_by_name ("XdndActionList"),
 		   XA_ATOM, 32, PropModeReplace,
 		   (guchar *)atomlist, n_atoms);
 
@@ -2173,7 +2173,7 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("XdndEnter", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndEnter");
   xev.xclient.format = 32;
   xev.xclient.window = private->drop_xid ? 
                            private->drop_xid : 
@@ -2185,7 +2185,7 @@
   xev.xclient.data.l[4] = 0;
 
   if (!private->xdnd_selection)
-    private->xdnd_selection = gdk_atom_intern ("XdndSelection", FALSE);
+    private->xdnd_selection = gdk_x11_get_xatom_by_name ("XdndSelection");
 
   if (g_list_length (context->targets) > 3)
     {
@@ -2200,7 +2200,7 @@
 
       while (tmp_list)
 	{
-	  xev.xclient.data.l[i] = GPOINTER_TO_INT (tmp_list->data);
+	  xev.xclient.data.l[i] = gdk_x11_atom_to_xatom (GDK_POINTER_TO_ATOM (tmp_list->data));
 	  tmp_list = tmp_list->next;
 	  i++;
 	}
@@ -2225,7 +2225,7 @@
   GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("XdndLeave", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndLeave");
   xev.xclient.format = 32;
   xev.xclient.window = private->drop_xid ? 
                            private->drop_xid : 
@@ -2254,7 +2254,7 @@
   XEvent xev;
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("XdndDrop", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndDrop");
   xev.xclient.format = 32;
   xev.xclient.window = private->drop_xid ? 
                            private->drop_xid : 
@@ -2287,7 +2287,7 @@
   XEvent xev;
 
   xev.xclient.type = ClientMessage;
-  xev.xclient.message_type = gdk_atom_intern ("XdndPosition", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndPosition");
   xev.xclient.format = 32;
   xev.xclient.window = private->drop_xid ? 
                            private->drop_xid : 
@@ -2317,20 +2317,20 @@
   Atom type = None;
   int format;
   unsigned long nitems, after;
-  GdkAtom *version;
+  Atom *version;
   Window *proxy_data;
   Window proxy;
-  static GdkAtom xdnd_proxy_atom = GDK_NONE;
+  static Atom xdnd_proxy_atom = None;
 
   gint old_warnings = _gdk_error_warnings;
 
   if (!xdnd_proxy_atom)
-    xdnd_proxy_atom = gdk_atom_intern ("XdndProxy", FALSE);
+    xdnd_proxy_atom = gdk_x11_get_xatom_by_name ("XdndProxy");
 
   if (!xdnd_aware_atom)
-    xdnd_aware_atom = gdk_atom_intern ("XdndAware", FALSE);
+    xdnd_aware_atom = gdk_x11_get_xatom_by_name ("XdndAware");
 
-  proxy = GDK_NONE;
+  proxy = None;
   
   _gdk_error_code = 0;
   _gdk_error_warnings = 0;
@@ -2381,7 +2381,7 @@
   _gdk_error_warnings = old_warnings;
   _gdk_error_code = 0;
   
-  return retval ? (proxy ? proxy : win) : GDK_NONE;
+  return retval ? (proxy ? proxy : win) : None;
 }
 
 /* Target side */
@@ -2405,7 +2405,7 @@
 
   XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
 		      GDK_DRAWABLE_XID (context->source_window),
-		      gdk_atom_intern ("XdndActionList", FALSE), 0, 65536,
+		      gdk_x11_get_xatom_by_name ("XdndActionList"), 0, 65536,
 		      False, XA_ATOM, &type, &format, &nitems,
 		      &after, (guchar **)&data);
   
@@ -2458,7 +2458,7 @@
   GdkDragContext *context = cb_data;
 
   if ((xevent->xany.type == PropertyNotify) &&
-      (xevent->xproperty.atom == gdk_atom_intern ("XdndActionList", FALSE)))
+      (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("XdndActionList")))
     {
       xdnd_read_actions (context);
 
@@ -2561,7 +2561,7 @@
       gdk_error_trap_push ();
       XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (event->any.window), 
 			  source_window, 
-			  gdk_atom_intern ("XdndTypeList", FALSE), 0, 65536,
+			  gdk_x11_get_xatom_by_name ("XdndTypeList"), 0, 65536,
 			  False, XA_ATOM, &type, &format, &nitems,
 			  &after, (guchar **)&data);
 
@@ -2573,7 +2573,7 @@
 
       for (i=0; i<nitems; i++)
 	new_context->targets = g_list_append (new_context->targets,
-					      GUINT_TO_POINTER (data[i]));
+					      GDK_ATOM_TO_POINTER (gdk_x11_xatom_to_atom (data[i])));
 
       XFree(data);
     }
@@ -2582,7 +2582,7 @@
       for (i=0; i<3; i++)
 	if (xevent->xclient.data.l[2+i])
 	  new_context->targets = g_list_append (new_context->targets,
-						GUINT_TO_POINTER (xevent->xclient.data.l[2+i]));
+						GDK_ATOM_TO_POINTER (gdk_x11_xatom_to_atom (xevent->xclient.data.l[2+i])));
     }
 
 #ifdef G_ENABLE_DEBUG
@@ -2599,7 +2599,7 @@
 
   current_dest_drag = new_context;
   (PRIVATE_DATA (new_context))->xdnd_selection = 
-    gdk_atom_intern ("XdndSelection", FALSE);
+    gdk_x11_get_xatom_by_name ("XdndSelection");
 
   return GDK_FILTER_TRANSLATE;
 }
@@ -2642,7 +2642,7 @@
   gint16 x_root = xevent->xclient.data.l[2] >> 16;
   gint16 y_root = xevent->xclient.data.l[2] & 0xffff;
   guint32 time = xevent->xclient.data.l[3];
-  GdkAtom action = xevent->xclient.data.l[4];
+  Atom action = xevent->xclient.data.l[4];
   
   GDK_NOTE (DND, 
 	    g_message ("XdndPosition: source_window: %#x  position: (%d, %d)  time: %d  action: %ld",
@@ -2772,7 +2772,6 @@
 gdk_drag_begin (GdkWindow     *window,
 		GList         *targets)
 {
-  GList *tmp_list;
   GdkDragContext *new_context;
   
   g_return_val_if_fail (window != NULL, NULL);
@@ -2781,16 +2780,8 @@
   new_context->is_source = TRUE;
   new_context->source_window = window;
   gdk_window_ref (window);
-
-  tmp_list = g_list_last (targets);
-  new_context->targets = NULL;
-  while (tmp_list)
-    {
-      new_context->targets = g_list_prepend (new_context->targets,
-					     tmp_list->data);
-      tmp_list = tmp_list->prev;
-    }
 
+  new_context->targets = g_list_copy (targets);
   new_context->actions = 0;
 
   return new_context;
@@ -2835,7 +2826,7 @@
 	  _gdk_error_code = 0;
 
 	  XGetWindowProperty (gdk_display, xid,
-			      gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE),
+			      gdk_x11_get_xatom_by_name ("ENLIGHTENMENT_DESKTOP"),
 			      0, 0, False, AnyPropertyType,
 			      &type, &format, &nitems, &after, &data);
 	  if ((_gdk_error_code == 0) && type != None)
@@ -2855,7 +2846,7 @@
 	  _gdk_error_code = 0;
 	  
 	  XGetWindowProperty (gdk_display, win,
-			      gdk_atom_intern ("__SWM_VROOT", FALSE),
+			      gdk_x11_get_xatom_by_name ("__SWM_VROOT"),
 			      0, 0, False, AnyPropertyType,
 			      &type, &format, &nitems, &data);
 	  if ((_gdk_error_code == 0) && type != None)
@@ -2873,7 +2864,7 @@
     }
 
   *protocol = GDK_DRAG_PROTO_NONE;
-  return GDK_NONE;
+  return None;
 }
 
 void
@@ -2894,7 +2885,7 @@
 
   dest = get_client_window_at_coords (private->window_cache,
 				      drag_window ? 
-				      GDK_DRAWABLE_XID (drag_window) : GDK_NONE,
+				      GDK_DRAWABLE_XID (drag_window) : None,
 				      x_root, y_root);
 
   if (private->dest_xid != dest)
@@ -3044,7 +3035,7 @@
 		GdkEvent temp_event;
 
 		if (g_list_find (context->targets,
-				 GUINT_TO_POINTER (gdk_atom_intern ("application/x-rootwin-drop", FALSE))))
+				 GDK_ATOM_TO_POINTER (gdk_atom_intern ("application/x-rootwin-drop", FALSE))))
 		  context->action = context->suggested_action;
 		else
 		  context->action = 0;
@@ -3131,7 +3122,7 @@
   if (context->protocol == GDK_DRAG_PROTO_MOTIF)
     {
       xev.xclient.type = ClientMessage;
-      xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
       xev.xclient.format = 8;
       xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
 
@@ -3188,7 +3179,7 @@
   else if (context->protocol == GDK_DRAG_PROTO_XDND)
     {
       xev.xclient.type = ClientMessage;
-      xev.xclient.message_type = gdk_atom_intern ("XdndStatus", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndStatus");
       xev.xclient.format = 32;
       xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
 
@@ -3224,7 +3215,7 @@
       XEvent xev;
 
       xev.xclient.type = ClientMessage;
-      xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_AND_DROP_MESSAGE");
       xev.xclient.format = 8;
 
       MOTIF_XCLIENT_BYTE (&xev, 0) = XmDROP_START | 0x80;
@@ -3259,7 +3250,7 @@
       XEvent xev;
 
       xev.xclient.type = ClientMessage;
-      xev.xclient.message_type = gdk_atom_intern ("XdndFinished", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndFinished");
       xev.xclient.format = 32;
       xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
 
@@ -3294,12 +3285,12 @@
   /* Set Motif drag receiver information property */
 
   if (!motif_drag_receiver_info_atom)
-    motif_drag_receiver_info_atom = gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE);
+    motif_drag_receiver_info_atom = gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_RECEIVER_INFO");
 
   info.byte_order = local_byte_order;
   info.protocol_version = 0;
   info.protocol_style = XmDRAG_DYNAMIC;
-  info.proxy_window = GDK_NONE;
+  info.proxy_window = None;
   info.num_drop_sites = 0;
   info.total_size = sizeof(info);
 
@@ -3313,7 +3304,7 @@
   /* Set XdndAware */
 
   if (!xdnd_aware_atom)
-    xdnd_aware_atom = gdk_atom_intern ("XdndAware", FALSE);
+    xdnd_aware_atom = gdk_x11_get_xatom_by_name ("XdndAware");
 
   /* The property needs to be of type XA_ATOM, not XA_INTEGER. Blech */
   XChangeProperty (GDK_DRAWABLE_XDISPLAY (window), 
@@ -3337,9 +3328,9 @@
   g_return_val_if_fail (context != NULL, GDK_NONE);
 
   if (context->protocol == GDK_DRAG_PROTO_MOTIF)
-    return (PRIVATE_DATA (context))->motif_selection;
+    return gdk_x11_xatom_to_atom ((PRIVATE_DATA (context))->motif_selection);
   else if (context->protocol == GDK_DRAG_PROTO_XDND)
-    return (PRIVATE_DATA (context))->xdnd_selection;
+    return gdk_x11_xatom_to_atom ((PRIVATE_DATA (context))->xdnd_selection);
   else 
     return GDK_NONE;
 }
Index: gdk/x11/gdkevents-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
retrieving revision 1.62
diff -u -r1.62 gdkevents-x11.c
--- gdk/x11/gdkevents-x11.c	2001/10/03 18:19:47	1.62
+++ gdk/x11/gdkevents-x11.c	2001/10/20 17:22:28
@@ -162,9 +162,9 @@
   g_source_set_can_recurse (source, TRUE);
   g_source_attach (source, NULL);
 
-  _gdk_wm_window_protocols[0] = gdk_atom_intern ("WM_DELETE_WINDOW", FALSE);
-  _gdk_wm_window_protocols[1] = gdk_atom_intern ("WM_TAKE_FOCUS", FALSE);
-  _gdk_wm_window_protocols[2] = gdk_atom_intern ("_NET_WM_PING", FALSE);
+  _gdk_wm_window_protocols[0] = gdk_x11_get_xatom_by_name ("WM_DELETE_WINDOW");
+  _gdk_wm_window_protocols[1] = gdk_x11_get_xatom_by_name ("WM_TAKE_FOCUS");
+  _gdk_wm_window_protocols[2] = gdk_x11_get_xatom_by_name ("_NET_WM_PING");
   
   gdk_add_client_message_filter (gdk_atom_intern ("WM_PROTOCOLS", FALSE),
 				 gdk_wm_protocols_filter, NULL);
@@ -286,8 +286,8 @@
   client_filters = g_list_prepend (client_filters, filter);
 }
 
-static GdkAtom wm_state_atom = 0;
-static GdkAtom wm_desktop_atom = 0;
+static Atom wm_state_atom = 0;
+static Atom wm_desktop_atom = 0;
 
 static void
 gdk_check_wm_state_changed (GdkWindow *window)
@@ -296,11 +296,11 @@
   gint format;
   gulong nitems;
   gulong bytes_after;
-  GdkAtom *atoms = NULL;
+  Atom *atoms = NULL;
   gulong i;
-  GdkAtom sticky_atom;
-  GdkAtom maxvert_atom;
-  GdkAtom maxhorz_atom;
+  Atom sticky_atom;
+  Atom maxvert_atom;
+  Atom maxhorz_atom;
   gboolean found_sticky, found_maxvert, found_maxhorz;
   GdkWindowState old_state;
   
@@ -308,10 +308,10 @@
     return;
   
   if (wm_state_atom == 0)
-    wm_state_atom = gdk_atom_intern ("_NET_WM_STATE", FALSE);
+    wm_state_atom = gdk_x11_get_xatom_by_name ("_NET_WM_STATE");
 
   if (wm_desktop_atom == 0)
-    wm_desktop_atom = gdk_atom_intern ("_NET_WM_DESKTOP", FALSE);
+    wm_desktop_atom = gdk_x11_get_xatom_by_name ("_NET_WM_DESKTOP");
   
   XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 		      wm_state_atom, 0, G_MAXLONG,
@@ -321,9 +321,9 @@
   if (type != None)
     {
 
-      sticky_atom = gdk_atom_intern ("_NET_WM_STATE_STICKY", FALSE);
-      maxvert_atom = gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_VERT", FALSE);
-      maxhorz_atom = gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_HORZ", FALSE);    
+      sticky_atom = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_STICKY");
+      maxvert_atom = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_MAXIMIZED_VERT");
+      maxhorz_atom = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_MAXIMIZED_HORZ");    
 
       found_sticky = FALSE;
       found_maxvert = FALSE;
@@ -1373,7 +1373,7 @@
       
     case PropertyNotify:
       GDK_NOTE (EVENTS,
-		gchar *atom = gdk_atom_name (xevent->xproperty.atom);
+		gchar *atom = gdk_x11_get_xatom_name (xevent->xproperty.atom);
 		g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s",
 			   xevent->xproperty.window,
 			   xevent->xproperty.atom,
@@ -1391,18 +1391,18 @@
       
       event->property.type = GDK_PROPERTY_NOTIFY;
       event->property.window = window;
-      event->property.atom = xevent->xproperty.atom;
+      event->property.atom = gdk_x11_xatom_to_atom (xevent->xproperty.atom);
       event->property.time = xevent->xproperty.time;
       event->property.state = xevent->xproperty.state;
 
       if (wm_state_atom == 0)
-        wm_state_atom = gdk_atom_intern ("_NET_WM_STATE", FALSE);
+        wm_state_atom = gdk_x11_get_xatom_by_name ("_NET_WM_STATE");
 
       if (wm_desktop_atom == 0)
-        wm_desktop_atom = gdk_atom_intern ("_NET_WM_DESKTOP", FALSE);
+        wm_desktop_atom = gdk_x11_get_xatom_by_name ("_NET_WM_DESKTOP");
       
-      if (event->property.atom == wm_state_atom ||
-          event->property.atom == wm_desktop_atom)
+      if (xevent->xproperty.atom == wm_state_atom || 
+	  xevent->xproperty.atom == wm_desktop_atom)
         {
           /* If window state changed, then synthesize those events. */
           gdk_check_wm_state_changed (event->property.window);
@@ -1419,7 +1419,7 @@
 	{
 	  event->selection.type = GDK_SELECTION_CLEAR;
 	  event->selection.window = window;
-	  event->selection.selection = xevent->xselectionclear.selection;
+	  event->selection.selection = gdk_x11_xatom_to_atom (xevent->xselectionclear.selection);
 	  event->selection.time = xevent->xselectionclear.time;
 	}
       else
@@ -1434,9 +1434,9 @@
       
       event->selection.type = GDK_SELECTION_REQUEST;
       event->selection.window = window;
-      event->selection.selection = xevent->xselectionrequest.selection;
-      event->selection.target = xevent->xselectionrequest.target;
-      event->selection.property = xevent->xselectionrequest.property;
+      event->selection.selection = gdk_x11_xatom_to_atom (xevent->xselectionrequest.selection);
+      event->selection.target = gdk_x11_xatom_to_atom (xevent->xselectionrequest.target);
+      event->selection.property = gdk_x11_xatom_to_atom (xevent->xselectionrequest.property);
       event->selection.requestor = xevent->xselectionrequest.requestor;
       event->selection.time = xevent->xselectionrequest.time;
       
@@ -1450,9 +1450,9 @@
       
       event->selection.type = GDK_SELECTION_NOTIFY;
       event->selection.window = window;
-      event->selection.selection = xevent->xselection.selection;
-      event->selection.target = xevent->xselection.target;
-      event->selection.property = xevent->xselection.property;
+      event->selection.selection = gdk_x11_xatom_to_atom (xevent->xselection.selection);
+      event->selection.target = gdk_x11_xatom_to_atom (xevent->xselection.target);
+      event->selection.property = gdk_x11_xatom_to_atom (xevent->xselection.property);
       event->selection.time = xevent->xselection.time;
       
       break;
@@ -1470,6 +1470,7 @@
       {
 	GList *tmp_list;
 	GdkFilterReturn result = GDK_FILTER_CONTINUE;
+	GdkAtom message_type = gdk_x11_xatom_to_atom (xevent->xclient.message_type);
 
 	GDK_NOTE (EVENTS,
 		  g_message ("client message:\twindow: %ld",
@@ -1479,7 +1480,7 @@
 	while (tmp_list)
 	  {
 	    GdkClientFilter *filter = tmp_list->data;
-	    if (filter->type == xevent->xclient.message_type)
+	    if (filter->type == message_type)
 	      {
 		result = (*filter->function) (xevent, event, filter->data);
 		break;
@@ -1506,7 +1507,7 @@
               {
                 event->client.type = GDK_CLIENT_EVENT;
                 event->client.window = window;
-                event->client.message_type = xevent->xclient.message_type;
+                event->client.message_type = message_type;
                 event->client.data_format = xevent->xclient.format;
                 memcpy(&event->client.data, &xevent->xclient.data,
                        sizeof(event->client.data));
@@ -1592,7 +1593,7 @@
 {
   XEvent *xevent = (XEvent *)xev;
 
-  if ((Atom) xevent->xclient.data.l[0] == gdk_atom_intern ("WM_DELETE_WINDOW", FALSE))
+  if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("WM_DELETE_WINDOW"))
     {
   /* The delete window request specifies a window
    *  to delete. We don't actually destroy the
@@ -1610,7 +1611,7 @@
 
       return GDK_FILTER_TRANSLATE;
     }
-  else if ((Atom) xevent->xclient.data.l[0] == gdk_atom_intern ("WM_TAKE_FOCUS", FALSE))
+  else if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("WM_TAKE_FOCUS"))
     {
       GdkWindow *win = event->any.window;
       Window focus_win = GDK_WINDOW_IMPL_X11(((GdkWindowObject *)win)->impl)->focus_window;
@@ -1626,7 +1627,7 @@
       XSync (GDK_WINDOW_XDISPLAY (win), False);
       gdk_error_trap_pop ();
     }
-  else if ((Atom) xevent->xclient.data.l[0] == gdk_atom_intern ("_NET_WM_PING", FALSE))
+  else if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("_NET_WM_PING"))
     {
       XEvent xev = *xevent;
       
@@ -1774,7 +1775,7 @@
   sev.xclient.format = event->client.data_format;
   sev.xclient.window = xid;
   memcpy(&sev.xclient.data, &event->client.data, sizeof(sev.xclient.data));
-  sev.xclient.message_type = event->client.message_type;
+  sev.xclient.message_type = gdk_x11_atom_to_xatom (event->client.message_type);
   
   return gdk_send_xevent (xid, False, NoEventMask, &sev);
 }
@@ -1785,7 +1786,7 @@
 					      guint32  xid,
 					      guint    level)
 {
-  static GdkAtom wm_state_atom = GDK_NONE;
+  static Atom wm_state_atom = None;
   Atom type = None;
   int format;
   unsigned long nitems, after;
@@ -1798,7 +1799,7 @@
   int i;
 
   if (!wm_state_atom)
-    wm_state_atom = gdk_atom_intern ("WM_STATE", FALSE);
+    wm_state_atom = gdk_x11_get_xatom_by_name ("WM_STATE");
 
   _gdk_error_warnings = FALSE;
   _gdk_error_code = 0;
@@ -1860,7 +1861,7 @@
   sev.xclient.display = gdk_display;
   sev.xclient.format = event->client.data_format;
   memcpy(&sev.xclient.data, &event->client.data, sizeof(sev.xclient.data));
-  sev.xclient.message_type = event->client.message_type;
+  sev.xclient.message_type = gdk_x11_atom_to_xatom (event->client.message_type);
 
   gdk_event_send_client_message_to_all_recurse(&sev, _gdk_root_window, 0);
 
@@ -1891,7 +1892,7 @@
   XSync (gdk_display, False);
 }
 
-static GdkAtom timestamp_prop_atom = 0;
+static Atom timestamp_prop_atom = 0;
 
 static Bool
 timestamp_predicate (Display *display,
@@ -1930,7 +1931,7 @@
   g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), 0);
 
   if (!timestamp_prop_atom)
-    timestamp_prop_atom = gdk_atom_intern ("GDK_TIMESTAMP_PROP", FALSE);
+    timestamp_prop_atom = gdk_x11_get_xatom_by_name ("GDK_TIMESTAMP_PROP");
 
   xdisplay = GDK_WINDOW_XDISPLAY (window);
   xwindow = GDK_WINDOW_XWINDOW (window);
@@ -1967,10 +1968,11 @@
 gboolean
 gdk_net_wm_supports (GdkAtom property)
 {
-  static GdkAtom wmspec_check_atom = 0;
-  static GdkAtom wmspec_supported_atom = 0;
-  static GdkAtom *atoms = NULL;
+  static Atom wmspec_check_atom = 0;
+  static Atom wmspec_supported_atom = 0;
+  static Atom *atoms = NULL;
   static gulong n_atoms = 0;
+  Atom xproperty = gdk_x11_atom_to_xatom (property);
   Atom type;
   gint format;
   gulong nitems;
@@ -1986,7 +1988,7 @@
       i = 0;
       while (i < n_atoms)
         {
-          if (atoms[i] == property)
+          if (atoms[i] == xproperty)
             return TRUE;
           
           ++i;
@@ -2010,10 +2012,10 @@
    */
   
   if (wmspec_check_atom == 0)
-    wmspec_check_atom = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", FALSE);
+    wmspec_check_atom = gdk_x11_get_xatom_by_name ("_NET_SUPPORTING_WM_CHECK");
       
   if (wmspec_supported_atom == 0)
-    wmspec_supported_atom = gdk_atom_intern ("_NET_SUPPORTED", FALSE);
+    wmspec_supported_atom = gdk_x11_get_xatom_by_name ("_NET_SUPPORTED");
   
   XGetWindowProperty (gdk_display, _gdk_root_window,
 		      wmspec_check_atom, 0, G_MAXLONG,
Index: gdk/x11/gdkglobals-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkglobals-x11.c,v
retrieving revision 1.27
diff -u -r1.27 gdkglobals-x11.c
--- gdk/x11/gdkglobals-x11.c	2001/09/07 21:50:09	1.27
+++ gdk/x11/gdkglobals-x11.c	2001/10/20 17:22:28
@@ -37,7 +37,7 @@
 Window            _gdk_root_window;
 Window            _gdk_leader_window;
 Atom              _gdk_wm_window_protocols[3];
-Atom              _gdk_selection_property;
+GdkAtom           _gdk_selection_property;
 
 GdkWindowObject *_gdk_xgrab_window = NULL;  /* Window that currently holds the
                                             *	x pointer grab
Index: gdk/x11/gdkkeys-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkkeys-x11.c,v
retrieving revision 1.10
diff -u -r1.10 gdkkeys-x11.c
--- gdk/x11/gdkkeys-x11.c	2001/10/03 18:19:47	1.10
+++ gdk/x11/gdkkeys-x11.c	2001/10/20 17:22:28
@@ -215,7 +215,7 @@
     result = PANGO_DIRECTION_LTR;
   else
     {
-      name = gdk_atom_name (xkb->names->groups[state_rec.locked_group]);
+      name = gdk_x11_get_xatom_name (xkb->names->groups[state_rec.locked_group]);
       if (g_strcasecmp (name, "arabic") == 0 ||
 	  g_strcasecmp (name, "hebrew") == 0 ||
 	  g_strcasecmp (name, "israelian") == 0)
Index: gdk/x11/gdkmain-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkmain-x11.c,v
retrieving revision 1.138
diff -u -r1.138 gdkmain-x11.c
--- gdk/x11/gdkmain-x11.c	2001/10/10 21:54:25	1.138
+++ gdk/x11/gdkmain-x11.c	2001/10/20 17:22:29
@@ -144,7 +144,7 @@
 
   pid = getpid();
   XChangeProperty (gdk_display, _gdk_leader_window,
-		   gdk_atom_intern ("_NET_WM_PID", FALSE),
+		   gdk_x11_get_xatom_by_name ("_NET_WM_PID"),
 		   XA_CARDINAL, 32,
 		   PropModeReplace,
 		   (guchar *)&pid, 1);
@@ -552,13 +552,13 @@
   if (sm_client_id && strcmp (sm_client_id, ""))
     {
       XChangeProperty (gdk_display, _gdk_leader_window,
-	   	       gdk_atom_intern ("SM_CLIENT_ID", FALSE),
+	   	       gdk_x11_get_xatom_by_name ("SM_CLIENT_ID"),
 		       XA_STRING, 8, PropModeReplace,
 		       sm_client_id, strlen(sm_client_id));
     }
   else
      XDeleteProperty (gdk_display, _gdk_leader_window,
-	   	      gdk_atom_intern ("SM_CLIENT_ID", FALSE));
+	   	      gdk_x11_get_xatom_by_name ("SM_CLIENT_ID"));
 }
 
 void
Index: gdk/x11/gdkprivate-x11.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkprivate-x11.h,v
retrieving revision 1.15
diff -u -r1.15 gdkprivate-x11.h
--- gdk/x11/gdkprivate-x11.h	2001/10/10 21:54:25	1.15
+++ gdk/x11/gdkprivate-x11.h	2001/10/20 17:22:29
@@ -159,7 +159,7 @@
 extern const int         _gdk_nenvent_masks;
 extern const int         _gdk_event_mask_table[];
 extern gint		 _gdk_screen;
-extern Atom		 _gdk_selection_property;
+extern GdkAtom		 _gdk_selection_property;
 extern gchar		*_gdk_display_name;
 
 extern Window		 _gdk_leader_window;
Index: gdk/x11/gdkproperty-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkproperty-x11.c,v
retrieving revision 1.21
diff -u -r1.21 gdkproperty-x11.c
--- gdk/x11/gdkproperty-x11.c	2001/09/07 21:50:09	1.21
+++ gdk/x11/gdkproperty-x11.c	2001/10/20 17:22:29
@@ -105,6 +274,8 @@
 {
   Display *xdisplay;
   Window xwindow;
+  Atom xproperty;
+  Atom xtype;
   Atom ret_prop_type;
   gint ret_format;
   gulong ret_nitems;
@@ -114,6 +285,9 @@
 
   g_return_val_if_fail (!window || GDK_IS_WINDOW (window), FALSE);
 
+  xproperty = gdk_x11_atom_to_xatom (property);
+  xtype = gdk_x11_atom_to_xatom (type);
+
   if (window)
     {
       if (GDK_WINDOW_DESTROYED (window))
@@ -129,9 +303,9 @@
     }
 
   ret_data = NULL;
-  XGetWindowProperty (xdisplay, xwindow, property,
+  XGetWindowProperty (xdisplay, xwindow, xproperty,
 		      offset, (length + 3) / 4, pdelete,
-		      type, &ret_prop_type, &ret_format,
+		      xtype, &ret_prop_type, &ret_format,
 		      &ret_nitems, &ret_bytes_after,
 		      &ret_data);
 
@@ -140,17 +314,17 @@
   }
 
   if (actual_property_type)
-    *actual_property_type = ret_prop_type;
+    *actual_property_type = gdk_x11_xatom_to_atom (ret_prop_type);
   if (actual_format_type)
     *actual_format_type = ret_format;
 
-  if ((type != AnyPropertyType) && (ret_prop_type != type))
+  if ((type != AnyPropertyType) && (ret_prop_type != xtype))
     {
       gchar *rn, *pn;
 
       XFree (ret_data);
-      rn = gdk_atom_name(ret_prop_type);
-      pn = gdk_atom_name(type);
+      rn = gdk_x11_get_xatom_name (ret_prop_type);
+      pn = gdk_x11_get_xatom_name (xtype);
       g_warning("Couldn't match property type %s to %s\n", rn, pn);
       g_free(rn); g_free(pn);
       return FALSE;
@@ -199,9 +373,14 @@
 {
   Display *xdisplay;
   Window xwindow;
+  Atom xproperty;
+  Atom xtype;
 
   g_return_if_fail (!window || GDK_IS_WINDOW (window));
 
+  xproperty = gdk_x11_atom_to_xatom (property);
+  xtype = gdk_x11_atom_to_xatom (type);
+
   if (window)
     {
       if (GDK_WINDOW_DESTROYED (window))
@@ -216,7 +395,7 @@
       xwindow = _gdk_root_window;
     }
 
-  XChangeProperty (xdisplay, xwindow, property, type,
+  XChangeProperty (xdisplay, xwindow, xproperty, xtype,
 		   format, mode, (guchar *)data, nelements);
 }
 
@@ -243,5 +422,5 @@
       xwindow = _gdk_root_window;
     }
 
-  XDeleteProperty (xdisplay, xwindow, property);
+  XDeleteProperty (xdisplay, xwindow, gdk_x11_atom_to_xatom (property));
 }
Index: gdk/x11/gdkselection-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkselection-x11.c,v
retrieving revision 1.19
diff -u -r1.19 gdkselection-x11.c
--- gdk/x11/gdkselection-x11.c	2001/09/07 21:50:09	1.19
+++ gdk/x11/gdkselection-x11.c	2001/10/20 17:22:29
@@ -77,7 +77,7 @@
   while (tmp_list)
     {
       OwnerInfo *info = tmp_list->data;
-      if (info->selection == event->selection)
+      if (info->selection == gdk_x11_xatom_to_atom (event->selection))
 	{
 	  if ((GDK_DRAWABLE_XID (info->owner) == event->window &&
 	       event->serial >= info->serial))
@@ -103,9 +103,12 @@
 {
   Display *xdisplay;
   Window xwindow;
+  Atom xselection;
   GSList *tmp_list;
   OwnerInfo *info;
 
+  xselection = gdk_x11_atom_to_xatom (selection);
+  
   if (owner)
     {
       if (GDK_WINDOW_DESTROYED (owner))
@@ -143,9 +146,9 @@
       owner_list = g_slist_prepend (owner_list, info);
     }
 
-  XSetSelectionOwner (xdisplay, selection, xwindow, time);
+  XSetSelectionOwner (xdisplay, xselection, xwindow, time);
 
-  return (XGetSelectionOwner (xdisplay, selection) == xwindow);
+  return (XGetSelectionOwner (xdisplay, xselection) == xwindow);
 }
 
 GdkWindow*
@@ -153,7 +156,7 @@
 {
   Window xwindow;
 
-  xwindow = XGetSelectionOwner (gdk_display, selection);
+  xwindow = XGetSelectionOwner (gdk_display, gdk_x11_atom_to_xatom (selection));
   if (xwindow == None)
     return NULL;
 
@@ -169,8 +172,11 @@
   if (GDK_WINDOW_DESTROYED (requestor))
     return;
 
-  XConvertSelection (GDK_WINDOW_XDISPLAY (requestor), selection, target,
-		     _gdk_selection_property, GDK_WINDOW_XID (requestor), time);
+  XConvertSelection (GDK_WINDOW_XDISPLAY (requestor),
+		     gdk_x11_atom_to_xatom (selection),
+		     gdk_x11_atom_to_xatom (target),
+		     gdk_x11_atom_to_xatom (_gdk_selection_property),
+		     GDK_WINDOW_XID (requestor), time);
 }
 
 gint
@@ -182,7 +188,7 @@
   gulong nitems;
   gulong nbytes;
   gulong length;
-  GdkAtom prop_type;
+  Atom prop_type;
   gint prop_format;
   guchar *t = NULL;
 
@@ -199,12 +205,13 @@
   t = NULL;
   XGetWindowProperty (GDK_WINDOW_XDISPLAY (requestor),
 		      GDK_WINDOW_XID (requestor),
-		      _gdk_selection_property, 0, 0, False,
+		      gdk_x11_atom_to_xatom (_gdk_selection_property),
+		      0, 0, False,
 		      AnyPropertyType, &prop_type, &prop_format,
 		      &nitems, &nbytes, &t);
 
   if (ret_type)
-    *ret_type = prop_type;
+    *ret_type = gdk_x11_xatom_to_atom (prop_type);
   if (ret_format)
     *ret_format = prop_format;
 
@@ -230,14 +237,30 @@
      Otherwise there's no guarantee we'll win the race ... */
   XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
 		      GDK_DRAWABLE_XID (requestor),
-		      _gdk_selection_property, 0, (nbytes + 3) / 4, False,
+		      gdk_x11_atom_to_xatom (_gdk_selection_property),
+		      0, (nbytes + 3) / 4, False,
 		      AnyPropertyType, &prop_type, &prop_format,
 		      &nitems, &nbytes, &t);
 
   if (prop_type != None)
     {
       *data = g_new (guchar, length);
-      memcpy (*data, t, length);
+
+      if (prop_type == XA_ATOM)
+	{
+	  Atom* atoms = (Atom*) t;
+	  GdkAtom* atoms_dest = (GdkAtom*) *data;
+	  gint num_atom, i;
+	  
+	  num_atom = (length - 1) / sizeof (GdkAtom);
+	  for (i=0; i < num_atom; i++)
+	    atoms_dest[i] = gdk_x11_xatom_to_atom (atoms[i]);
+	}
+      else
+	{
+	  memcpy (*data, t, length);
+	}
+      
       if (t)
 	XFree (t);
       return length-1;
@@ -264,9 +287,9 @@
   xevent.send_event = True;
   xevent.display = gdk_display;
   xevent.requestor = requestor;
-  xevent.selection = selection;
-  xevent.target = target;
-  xevent.property = property;
+  xevent.selection = gdk_x11_atom_to_xatom (selection);
+  xevent.target = gdk_x11_atom_to_xatom (target);
+  xevent.property = gdk_x11_atom_to_xatom (property);
   xevent.time = time;
 
   gdk_send_xevent (requestor, False, NoEventMask, (XEvent*) &xevent);
@@ -287,7 +310,7 @@
     return 0;
 
   property.value = (guchar *)text;
-  property.encoding = encoding;
+  property.encoding = gdk_x11_atom_to_xatom (encoding);
   property.format = format;
   property.nitems = length;
   res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
@@ -489,7 +512,7 @@
     }
 
   if (encoding)
-    *encoding = property.encoding;
+    *encoding = gdk_x11_xatom_to_atom (property.encoding);
   if (format)
     *format = property.format;
   if (ctext)
Index: gdk/x11/gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.129
diff -u -r1.129 gdkwindow-x11.c
--- gdk/x11/gdkwindow-x11.c	2001/10/18 20:23:16	1.129
+++ gdk/x11/gdkwindow-x11.c	2001/10/20 17:22:30
@@ -298,7 +298,7 @@
   gdk_xid_table_insert (&_gdk_root_window, _gdk_parent_root);
 }
 
-static GdkAtom wm_client_leader_atom = GDK_NONE;
+static Atom wm_client_leader_atom = None;
 
 /**
  * gdk_window_new:
@@ -590,14 +590,14 @@
   XSetWMHints (xdisplay, xid, &wm_hints);
   
   if (!wm_client_leader_atom)
-    wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
+    wm_client_leader_atom = gdk_x11_get_xatom_by_name ("WM_CLIENT_LEADER");
 
   /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME */
   XSetWMProperties (xdisplay, xid, NULL, NULL, NULL, 0, NULL, NULL, NULL);
 
   pid = getpid ();
   XChangeProperty (xdisplay, xid,
-		   gdk_atom_intern ("_NET_WM_PID", FALSE),
+		   gdk_x11_get_xatom_by_name ("_NET_WM_PID"),
 		   XA_CARDINAL, 32,
 		   PropModeReplace,
 		   (guchar *)&pid, 1);
@@ -754,9 +754,9 @@
 	  
 	  xevent.type = ClientMessage;
 	  xevent.window = GDK_WINDOW_XID (window);
-	  xevent.message_type = gdk_atom_intern ("WM_PROTOCOLS", FALSE);
+	  xevent.message_type = gdk_x11_get_xatom_by_name ("WM_PROTOCOLS");
 	  xevent.format = 32;
-	  xevent.data.l[0] = gdk_atom_intern ("WM_DELETE_WINDOW", FALSE);
+	  xevent.data.l[0] = gdk_x11_get_xatom_by_name ("WM_DELETE_WINDOW");
 	  xevent.data.l[1] = CurrentTime;
 	  
 	  XSendEvent (GDK_WINDOW_XDISPLAY (window),
@@ -800,7 +800,7 @@
 set_initial_hints (GdkWindow *window)
 {
   GdkWindowObject *private;
-  GdkAtom atoms[5];
+  Atom atoms[5];
   gint i;
   
   private = (GdkWindowObject*) window;
@@ -831,21 +831,21 @@
 
   if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
     {
-      atoms[i] = gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_VERT", FALSE);
+      atoms[i] = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_MAXIMIZED_VERT");
       ++i;
-      atoms[i] = gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_HORZ", FALSE);
+      atoms[i] = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_MAXIMIZED_HORZ");
       ++i;
     }
 
   if (private->state & GDK_WINDOW_STATE_STICKY)
     {
-      atoms[i] = gdk_atom_intern ("_NET_WM_STATE_STICKY", FALSE);
+      atoms[i] = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_STICKY");
       ++i;
     }
 
   if (private->modal_hint)
     {
-      atoms[i] = gdk_atom_intern ("_NET_WM_STATE_MODAL", FALSE);
+      atoms[i] = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_MODAL");
       ++i;
     }
 
@@ -853,7 +853,7 @@
     {
       XChangeProperty (GDK_WINDOW_XDISPLAY (window),
                        GDK_WINDOW_XID (window),
-                       gdk_atom_intern ("_NET_WM_STATE", FALSE),
+                       gdk_x11_get_xatom_by_name ("_NET_WM_STATE"),
                        XA_ATOM, 32, PropModeReplace,
                        (guchar*) atoms, i);
     }
@@ -863,7 +863,7 @@
       atoms[0] = 0xFFFFFFFF;
       XChangeProperty (GDK_WINDOW_XDISPLAY (window),
                        GDK_WINDOW_XID (window),
-                       gdk_atom_intern ("_NET_WM_DESKTOP", FALSE),
+                       gdk_x11_get_xatom_by_name ("_NET_WM_DESKTOP"),
                        XA_CARDINAL, 32, PropModeReplace,
                        (guchar*) atoms, 1);
     }
@@ -1359,7 +1359,7 @@
       xev.xclient.send_event = True;
       xev.xclient.window = GDK_WINDOW_XWINDOW (window);
       xev.xclient.display = gdk_display;
-      xev.xclient.message_type = gdk_atom_intern ("_NET_ACTIVE_WINDOW", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
       xev.xclient.format = 32;
       xev.xclient.data.l[0] = 0;
       
@@ -1468,7 +1468,7 @@
 gdk_window_set_type_hint (GdkWindow        *window,
 			  GdkWindowTypeHint hint)
 {
-  GdkAtom atom;
+  Atom atom;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1479,35 +1479,35 @@
   switch (hint)
     {
     case GDK_WINDOW_TYPE_HINT_DIALOG:
-      atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_DIALOG", FALSE);
+      atom = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE_DIALOG");
       break;
     case GDK_WINDOW_TYPE_HINT_MENU:
-      atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_MENU", FALSE);
+      atom = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE_MENU");
       break;
     case GDK_WINDOW_TYPE_HINT_TOOLBAR:
-      atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_TOOLBAR", FALSE);
+      atom = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE_TOOLBAR");
       break;
     default:
       g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint);
       /* Fall thru */
     case GDK_WINDOW_TYPE_HINT_NORMAL:
-      atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_NORMAL", FALSE);
+      atom = gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE_NORMAL");
       break;
     }
 
   XChangeProperty (GDK_WINDOW_XDISPLAY (window),
 		   GDK_WINDOW_XID (window),
-		   gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE),
+		   gdk_x11_get_xatom_by_name ("_NET_WM_WINDOW_TYPE"),
 		   XA_ATOM, 32, PropModeReplace,
 		   (guchar *)&atom, 1);
 }
 
 
 static void
-gdk_wmspec_change_state (gboolean add,
+gdk_wmspec_change_state (gboolean   add,
 			 GdkWindow *window,
-			 GdkAtom state1,
-			 GdkAtom state2)
+			 GdkAtom    state1,
+			 GdkAtom    state2)
 {
   XEvent xev;
 
@@ -1520,11 +1520,11 @@
   xev.xclient.send_event = True;
   xev.xclient.display = gdk_display;
   xev.xclient.window = GDK_WINDOW_XID (window);
-  xev.xclient.message_type = gdk_atom_intern ("_NET_WM_STATE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_WM_STATE");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
-  xev.xclient.data.l[1] = state1;
-  xev.xclient.data.l[2] = state2;
+  xev.xclient.data.l[1] = gdk_x11_atom_to_xatom (state1);
+  xev.xclient.data.l[2] = gdk_x11_atom_to_xatom (state2);
   
   XSendEvent (gdk_display, _gdk_root_window, False,
 	      SubstructureRedirectMask | SubstructureNotifyMask,
@@ -1761,25 +1761,28 @@
  */
 static void
 set_text_property (GdkWindow   *window,
-		   GdkAtom      property,
+		   Atom         property,
 		   const gchar *utf8_str)
 {
   guchar *prop_text = NULL;
-  GdkAtom prop_type;
+  Atom prop_type;
   gint prop_length;
   gint prop_format;
   
   if (utf8_is_latin1 (utf8_str))
     {
-      prop_type = GDK_TARGET_STRING;
+      prop_type = XA_STRING;
       prop_text = gdk_utf8_to_string_target (utf8_str);
       prop_length = strlen (prop_text);
       prop_format = 8;
     }
   else
     {
-      gdk_utf8_to_compound_text (utf8_str, &prop_type, &prop_format,
+      GdkAtom gdk_type;
+      
+      gdk_utf8_to_compound_text (utf8_str, &gdk_type, &prop_format,
 				 &prop_text, &prop_length);
+      prop_type = gdk_x11_atom_to_xatom (gdk_type);
     }
 
   if (prop_text)
@@ -1820,21 +1823,21 @@
   
   XChangeProperty (GDK_WINDOW_XDISPLAY (window),
 		   GDK_WINDOW_XID (window),
-		   gdk_atom_intern ("_NET_WM_NAME", FALSE),
-		   gdk_atom_intern ("UTF8_STRING", FALSE), 8,
+		   gdk_x11_get_xatom_by_name ("_NET_WM_NAME"),
+		   gdk_x11_get_xatom_by_name ("UTF8_STRING"), 8,
 		   PropModeReplace, title,
 		   strlen (title));
 
-  set_text_property (window, gdk_atom_intern ("WM_NAME", FALSE), title);
+  set_text_property (window, gdk_x11_get_xatom_by_name ("WM_NAME"), title);
   if (!gdk_window_icon_name_set (window))
     {
       XChangeProperty (GDK_WINDOW_XDISPLAY (window),
 		       GDK_WINDOW_XID (window),
-		       gdk_atom_intern ("_NET_WM_ICON_NAME", FALSE),
-		       gdk_atom_intern ("UTF8_STRING", FALSE), 8,
+		       gdk_x11_get_xatom_by_name ("_NET_WM_ICON_NAME"),
+		       gdk_x11_get_xatom_by_name ("UTF8_STRING"), 8,
 		       PropModeReplace, title,
 		       strlen (title));
-      set_text_property (window, gdk_atom_intern ("WM_ICON_NAME", FALSE), title);
+      set_text_property (window, gdk_x11_get_xatom_by_name ("WM_ICON_NAME"), title);
     }
 }
 
@@ -1868,11 +1871,11 @@
     {
       if (role)
 	XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
-			 gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
+			 gdk_x11_get_xatom_by_name ("WM_WINDOW_ROLE"), XA_STRING,
 			 8, PropModeReplace, role, strlen (role));
       else
 	XDeleteProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
-			 gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
+			 gdk_x11_get_xatom_by_name ("WM_WINDOW_ROLE"));
     }
 }
 
@@ -2196,7 +2199,7 @@
   if (!GDK_WINDOW_DESTROYED (window))
     {
       if (!atom)
-	atom = gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE);
+	atom = gdk_x11_get_xatom_by_name ("ENLIGHTENMENT_DESKTOP");
       win = GDK_WINDOW_XID (window);
       
       while (XQueryTree (GDK_WINDOW_XDISPLAY (window), win, &root, &parent,
@@ -2828,7 +2831,7 @@
     {
       XChangeProperty (GDK_WINDOW_XDISPLAY (window),
                        GDK_WINDOW_XID (window),
-                       gdk_atom_intern ("_NET_WM_ICON", FALSE),
+                       gdk_x11_get_xatom_by_name ("_NET_WM_ICON"),
                        XA_CARDINAL, 32,
                        PropModeReplace,
                        (guchar*) data, size);
@@ -2837,7 +2840,7 @@
     {
       XDeleteProperty (GDK_WINDOW_XDISPLAY (window),
                        GDK_WINDOW_XID (window),
-                       gdk_atom_intern ("_NET_WM_ICON", FALSE));
+                       gdk_x11_get_xatom_by_name ("_NET_WM_ICON"));
     }
 }
 
@@ -2930,11 +2933,11 @@
 
   XChangeProperty (GDK_WINDOW_XDISPLAY (window),
 		   GDK_WINDOW_XID (window),
-		   gdk_atom_intern ("_NET_WM_ICON_NAME", FALSE),
-		   gdk_atom_intern ("UTF8_STRING", FALSE), 8,
+		   gdk_x11_get_xatom_by_name ("_NET_WM_ICON_NAME"),
+		   gdk_x11_get_xatom_by_name ("UTF8_STRING"), 8,
 		   PropModeReplace, name,
 		   strlen (name));
-  set_text_property (window, gdk_atom_intern ("WM_ICON_NAME", FALSE), name);
+  set_text_property (window, gdk_x11_get_xatom_by_name ("WM_ICON_NAME"), name);
 }
 
 /**
@@ -3058,7 +3061,7 @@
       xev.xclient.send_event = True;
       xev.xclient.window = GDK_WINDOW_XWINDOW (window);
       xev.xclient.display = gdk_display;
-      xev.xclient.message_type = gdk_atom_intern ("_NET_WM_DESKTOP", FALSE);
+      xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_WM_DESKTOP");
       xev.xclient.format = 32;
 
       xev.xclient.data.l[0] = 0xFFFFFFFF;
@@ -3110,7 +3113,7 @@
        * one that matters much in practice.
        */
       XGetWindowProperty (gdk_display, _gdk_root_window,
-                          gdk_atom_intern ("_NET_CURRENT_DESKTOP", FALSE),
+                          gdk_x11_get_xatom_by_name ("_NET_CURRENT_DESKTOP"),
                           0, G_MAXLONG,
                           False, XA_CARDINAL, &type, &format, &nitems,
                           &bytes_after, (guchar **)&current_desktop);
@@ -3122,7 +3125,7 @@
           xev.xclient.send_event = True;
           xev.xclient.window = GDK_WINDOW_XWINDOW (window);
           xev.xclient.display = gdk_display;
-          xev.xclient.message_type = gdk_atom_intern ("_NET_WM_DESKTOP", FALSE);
+          xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_WM_DESKTOP");
           xev.xclient.format = 32;
 
           xev.xclient.data.l[0] = *current_desktop;
@@ -4077,7 +4080,7 @@
   xev.xclient.send_event = True;
   xev.xclient.display = gdk_display;
   xev.xclient.window = GDK_WINDOW_XID (window);
-  xev.xclient.message_type = gdk_atom_intern ("_NET_WM_MOVERESIZE", FALSE);
+  xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_WM_MOVERESIZE");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = root_x;
   xev.xclient.data.l[1] = root_y;
Index: gtk/gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.205
diff -u -r1.205 gtkclist.c
--- gtk/gtkclist.c	2001/09/19 00:49:51	1.205
+++ gtk/gtkclist.c	2001/10/20 17:22:32
@@ -7450,7 +7450,7 @@
 	  list = context->targets;
 	  while (list)
 	    {
-	      if (atom == GPOINTER_TO_INT (list->data))
+	      if (atom == GDK_POINTER_TO_ATOM (list->data))
 		{
 		  GTK_CLIST_GET_CLASS (clist)->draw_drag_highlight
 		    (clist,
@@ -7505,7 +7505,7 @@
       list = context->targets;
       while (list)
 	{
-	  if (atom == GPOINTER_TO_INT (list->data))
+	  if (atom == GDK_POINTER_TO_ATOM (list->data))
 	    break;
 	  list = list->next;
 	}
@@ -7581,7 +7581,7 @@
       list = context->targets;
       while (list)
 	{
-	  if (atom == GPOINTER_TO_INT (list->data))
+	  if (atom == GDK_POINTER_TO_ATOM (list->data))
 	    return TRUE;
 	  list = list->next;
 	}
Index: gtk/gtkctree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkctree.c,v
retrieving revision 1.92
diff -u -r1.92 gtkctree.c
--- gtk/gtkctree.c	2001/09/25 01:12:08	1.92
+++ gtk/gtkctree.c	2001/10/20 17:22:33
@@ -5988,7 +5988,7 @@
       list = context->targets;
       while (list)
 	{
-	  if (atom == GPOINTER_TO_INT (list->data))
+	  if (atom == GDK_POINTER_TO_ATOM (list->data))
 	    break;
 	  list = list->next;
 	}
Index: gtk/gtkdnd.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdnd.c,v
retrieving revision 1.70
diff -u -r1.70 gtkdnd.c
--- gtk/gtkdnd.c	2001/10/17 21:41:46	1.70
+++ gtk/gtkdnd.c	2001/10/20 17:22:34
@@ -1353,7 +1353,7 @@
   while (tmp_list)
     {
       gtk_target_list_add (source_info->target_list, 
-			   GPOINTER_TO_UINT (tmp_list->data), 0, 0);
+			   GDK_POINTER_TO_ATOM (tmp_list->data), 0, 0);
       tmp_list = tmp_list->next;
     }
 
@@ -2446,7 +2446,7 @@
   tmp_list = info->selections;
   while (tmp_list)
     {
-      if (GPOINTER_TO_UINT (tmp_list->data) == selection)
+      if (GDK_POINTER_TO_ATOM (tmp_list->data) == selection)
 	return;
       tmp_list = tmp_list->next;
     }
@@ -2546,7 +2546,7 @@
   GList *tmp_list = info->selections;
   while (tmp_list)
     {
-      GdkAtom selection = GPOINTER_TO_UINT (tmp_list->data);
+      GdkAtom selection = GDK_POINTER_TO_ATOM (tmp_list->data);
       if (gdk_selection_owner_get (selection) == info->ipc_widget->window)
 	gtk_selection_owner_set (NULL, selection, time);
       tmp_list = tmp_list->next;
Index: gtk/gtkplug.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkplug.c,v
retrieving revision 1.35
diff -u -r1.35 gtkplug.c
--- gtk/gtkplug.c	2001/10/18 22:05:23	1.35
+++ gtk/gtkplug.c	2001/10/20 17:22:34
@@ -850,7 +850,7 @@
 
       xevent.xclient.window = GDK_WINDOW_XWINDOW (plug->socket_window);
       xevent.xclient.type = ClientMessage;
-      xevent.xclient.message_type = gdk_atom_intern ("_XEMBED", FALSE);
+      xevent.xclient.message_type = gdk_x11_get_xatom_by_name ("_XEMBED");
       xevent.xclient.format = 32;
       xevent.xclient.data.l[0] = time;
       xevent.xclient.data.l[1] = message;
@@ -918,7 +918,7 @@
   Window window = GDK_WINDOW_XWINDOW (gdk_window);
   unsigned long buffer[2];
   
-  Atom xembed_info_atom = gdk_atom_intern ("_XEMBED_INFO", FALSE);
+  Atom xembed_info_atom = gdk_x11_get_xatom_by_name ("_XEMBED_INFO");
 
   buffer[1] = 0;		/* Protocol version */
   buffer[1] = flags;
@@ -1015,7 +1015,7 @@
   switch (xevent->type)
     {
     case ClientMessage:
-      if (xevent->xclient.message_type == gdk_atom_intern ("_XEMBED", FALSE))
+      if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name ("_XEMBED"))
 	{
 	  handle_xembed_message (plug,
 				 xevent->xclient.data.l[1],
@@ -1027,7 +1027,7 @@
 
 	  return GDK_FILTER_REMOVE;
 	}
-      else if (xevent->xclient.message_type == gdk_atom_intern ("WM_DELETE_WINDOW", FALSE))
+      else if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name ("WM_DELETE_WINDOW"))
 	{
 	  /* We filter these out because we take being reparented back to the
 	   * root window as the reliable end of the embedding protocol
Index: gtk/gtksocket.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksocket.c,v
retrieving revision 1.33
diff -u -r1.33 gtksocket.c
--- gtk/gtksocket.c	2001/09/20 15:08:00	1.33
+++ gtk/gtksocket.c	2001/10/20 17:22:34
@@ -1077,7 +1077,7 @@
 
       xevent.xclient.window = GDK_WINDOW_XWINDOW (socket->plug_window);
       xevent.xclient.type = ClientMessage;
-      xevent.xclient.message_type = gdk_atom_intern ("_XEMBED", FALSE);
+      xevent.xclient.message_type = gdk_x11_get_xatom_by_name ("_XEMBED");
       xevent.xclient.format = 32;
       xevent.xclient.data.l[0] = time;
       xevent.xclient.data.l[1] = message;
@@ -1101,7 +1101,7 @@
 {
   Display *display = GDK_WINDOW_XDISPLAY (gdk_window);
   Window window = GDK_WINDOW_XWINDOW (gdk_window);
-  Atom xembed_info_atom = gdk_atom_intern ("_XEMBED_INFO", FALSE);
+  Atom xembed_info_atom = gdk_x11_get_xatom_by_name ("_XEMBED_INFO");
   Atom type;
   int format;
   unsigned long nitems, bytes_after;
@@ -1244,7 +1244,7 @@
   switch (xevent->type)
     {
     case ClientMessage:
-      if (xevent->xclient.message_type == gdk_atom_intern ("_XEMBED", FALSE))
+      if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name ("_XEMBED"))
 	{
 	  handle_xembed_message (socket,
 				 xevent->xclient.data.l[1],
@@ -1394,8 +1394,8 @@
 	{
 	  GdkDragProtocol protocol;
 
-	  if ((xevent->xproperty.atom == gdk_atom_intern ("XdndAware", FALSE)) ||
-	      (xevent->xproperty.atom == gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE)))
+	  if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("XdndAware")) ||
+	      (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_RECEIVER_INFO")))
 	    {
 	      gdk_error_trap_push ();
 	      if (gdk_drag_get_protocol (xevent->xproperty.window, &protocol))
@@ -1405,7 +1405,7 @@
 	      gdk_flush ();
 	      gdk_error_trap_pop ();
 	    }
-	  else if (xevent->xproperty.atom == gdk_atom_intern ("_XEMBED_INFO", FALSE))
+	  else if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_XEMBED_INFO"))
 	    {
 	      unsigned long flags;
 	      
Index: tests/testdnd.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testdnd.c,v
retrieving revision 1.11
diff -u -r1.11 testdnd.c
--- tests/testdnd.c	2001/05/25 15:43:53	1.11
+++ tests/testdnd.c	2001/10/20 17:22:36
@@ -320,7 +320,7 @@
   tmp_list = context->targets;
   while (tmp_list)
     {
-      char *name = gdk_atom_name (GPOINTER_TO_UINT (tmp_list->data));
+      char *name = gdk_atom_name (GDK_POINTER_TO_ATOM (tmp_list->data));
       g_print ("%s\n", name);
       g_free (name);
       
@@ -346,7 +346,7 @@
   if (context->targets)
     {
       gtk_drag_get_data (widget, context, 
-			 GPOINTER_TO_INT (context->targets->data), 
+			 GDK_POINTER_TO_ATOM (context->targets->data), 
 			 time);
       return TRUE;
     }
Index: tests/testselection.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testselection.c,v
retrieving revision 1.18
diff -u -r1.18 testselection.c
--- tests/testselection.c	2001/06/07 22:33:14	1.18
+++ tests/testselection.c	2001/10/20 17:22:36
@@ -289,9 +289,8 @@
   if (seltype == SEL_TYPE_NONE)
     {
       char *name = gdk_atom_name (data->type);
-      g_print("Don't know how to handle type: %s (%ld)\n",
-	      name?name:"<unknown>",
-	      data->type);
+      g_print("Don't know how to handle type: %s\n",
+	      name?name:"<unknown>");
       return;
     }
 
@@ -335,9 +334,8 @@
 	default:
 	  {
 	    char *name = gdk_atom_name (data->type);
-	    g_print("Can't convert type %s (%ld) to string\n",
-		    name?name:"<unknown>",
-		    data->type);
+	    g_print("Can't convert type %s to string\n",
+		    name?name:"<unknown>");
 	    position = data->length;
 	    continue;
 	  }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]