Commit 46dde804 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Fix problem with g_return_if_fail return value.

Sun Oct 21 23:27:00 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
	problem with g_return_if_fail return value.

 	* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
 	gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().

	* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
	an opaque pointer type so the compiler catches attempts
	to mingle it with X atoms.

	* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
	  gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
	  gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
	  gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
	  tests/testdnd.c,tests/testselection.c:
	Fix up for above atom changes.

	* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
	now have the ability to add custom predefines.

	* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
	Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
	to gtk_clipboard_get().

	* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
	for GdkAtom => pointer change.

	* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
	atoms, fix for GdkAtom => pointer change.
parent 724a552c
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: 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-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
Mon Oct 22 00:26:46 2001 Kristian Rietveld <kristian@planet.nl>
* gtk/gtkspinbutton.c: remove ARROW_SIZE constant, use
......
......@@ -7,35 +7,33 @@
extern "C" {
#endif /* __cplusplus */
/* The next three types define enums for predefined atoms relating
to selections. In general, one will need to use gdk_intern_atom */
typedef enum
{
GDK_SELECTION_PRIMARY = 1,
GDK_SELECTION_SECONDARY = 2
} GdkSelection;
typedef enum
{
GDK_TARGET_BITMAP = 5,
GDK_TARGET_COLORMAP = 7,
GDK_TARGET_DRAWABLE = 17,
GDK_TARGET_PIXMAP = 20,
GDK_TARGET_STRING = 31
} GdkTarget;
typedef enum
{
GDK_SELECTION_TYPE_ATOM = 4,
GDK_SELECTION_TYPE_BITMAP = 5,
GDK_SELECTION_TYPE_COLORMAP = 7,
GDK_SELECTION_TYPE_DRAWABLE = 17,
GDK_SELECTION_TYPE_INTEGER = 19,
GDK_SELECTION_TYPE_PIXMAP = 20,
GDK_SELECTION_TYPE_WINDOW = 33,
GDK_SELECTION_TYPE_STRING = 31
} GdkSelectionType;
/* Predefined atoms relating to selections. In general, one will need to use
* gdk_intern_atom
*/
#define GDK_SELECTION_PRIMARY _GDK_MAKE_ATOM (1)
#define GDK_SELECTION_SECONDARY _GDK_MAKE_ATOM (2)
#define GDK_SELECTION_CLIPBOARD _GDK_MAKE_ATOM (69)
#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)
#ifndef GDK_DISABLE_DEPRECATED
typedef GdkAtom GdkSelection;
typedef GdkAtom GdkTarget;
typedef GdkAtom GdkSelectionType;
#endif /* GDK_DISABLE_DEPRECATED */
/* Selections
*/
......
......@@ -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,14 @@ typedef struct _GdkSpan GdkSpan;
* on Win32, wchar_t is unsigned short.
*/
typedef guint32 GdkWChar;
typedef gulong GdkAtom;
typedef struct _GdkAtom *GdkAtom;
#define GDK_ATOM_TO_POINTER(atom) (atom)
#define GDK_POINTER_TO_ATOM(ptr) ((GdkAtom)(ptr))
#define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
#define GDK_NONE _GDK_MAKE_ATOM (0)
#ifdef GDK_NATIVE_WINDOW_POINTER
typedef gpointer GdkNativeWindow;
......
......@@ -38,13 +38,58 @@ gdk_atom_intern (const gchar *atom_name,
{
g_return_val_if_fail (atom_name != NULL, GDK_NONE);
return g_quark_from_string (atom_name);
if (strcmp (atom_name, "PRIMARY") == 0)
return GDK_SELECTION_PRIMARY;
else if (strcmp (atom_name, "SECONDARY") == 0)
return GDK_SELECTION_SECONDARY;
else if (strcmp (atom_name, "CLIPBOARD") == 0)
return GDK_SELECTION_CLIPBOARD;
else if (strcmp (atom_name, "ATOM") == 0)
return GDK_SELECTION_TYPE_ATOM;
else if (strcmp (atom_name, "BITMAP") == 0)
return GDK_SELECTION_TYPE_BITMAP;
else if (strcmp (atom_name, "COLORMAP") == 0)
return GDK_SELECTION_TYPE_COLORMAP;
else if (strcmp (atom_name, "DRAWABLE") == 0)
return GDK_SELECTION_TYPE_DRAWABLE;
else if (strcmp (atom_name, "INTEGER") == 0)
return GDK_SELECTION_TYPE_INTEGER;
else if (strcmp (atom_name, "PIXMAP") == 0)
return GDK_SELECTION_TYPE_PIXMAP;
else if (strcmp (atom_name, "WINDOW") == 0)
return GDK_SELECTION_TYPE_WINDOW;
else if (strcmp (atom_name, "STRING") == 0)
return GDK_SELECTION_TYPE_STRING;
else
return GUINT_TO_POINTER (256 + g_quark_from_string (atom_name));
}
gchar*
gdk_atom_name (GdkAtom atom)
{
return g_strdup (g_quark_to_string (atom));
if (atom < 256)
{
switch (GPOINTER_TO_UINT (atom))
{
case GDK_SELECTION_PRIMARY: return g_strdup ("PRIMARY");
case GDK_SELECTION_SECONDARY: return g_strdup ("SECONDARY");
case GDK_SELECTION_CLIPBOARD: return g_strdup ("CLIPBOARD");
case GDK_SELECTION_TYPE_ATOM: return g_strdup ("ATOM");
case GDK_SELECTION_TYPE_BITMAP: return g_strdup ("BITMAP");
case GDK_SELECTION_TYPE_COLORMAP: return g_strdup ("COLORMAP");
case GDK_SELECTION_TYPE_DRAWABLE: return g_strdup ("DRAWABLE");
case GDK_SELECTION_TYPE_INTEGER: return g_strdup ("INTEGER");
case GDK_SELECTION_TYPE_PIXMAP: return g_strdup ("PIXMAP");
case GDK_SELECTION_TYPE_WINDOW: return g_strdup ("WINDOW");
case GDK_SELECTION_TYPE_STRING: return g_strdup ("STRING");
default:
g_warning (G_STRLOC "Invalid atom");
return g_strdup ("<invalid>");
}
}
else
return g_strdup (g_quark_to_string (atom - 256));
}
static void
......
......@@ -41,17 +41,20 @@ gdk_atom_intern (const gchar *atom_name,
{
GdkAtom retval;
static GHashTable *atom_hash = NULL;
ATOM win32_atom;
if (!atom_hash)
atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
retval = g_hash_table_lookup (atom_hash, atom_name);
if (!retval)
{
if (strcmp (atom_name, "PRIMARY") == 0)
retval = GDK_SELECTION_PRIMARY;
else if (strcmp (atom_name, "SECONDARY") == 0)
retval = GDK_SELECTION_SECONDARY;
else if (strcmp (atom_name, "CLIPBOARD") == 0)
retval = GDK_SELECTION_CLIPBOARD;
else if (strcmp (atom_name, "ATOM") == 0)
retval = GDK_SELECTION_TYPE_ATOM;
else if (strcmp (atom_name, "BITMAP") == 0)
......@@ -70,15 +73,16 @@ gdk_atom_intern (const gchar *atom_name,
retval = GDK_SELECTION_TYPE_STRING;
else
{
retval = GlobalFindAtom (atom_name);
win32_atom = GlobalFindAtom (atom_name);
if (only_if_exists && retval == 0)
retval = 0;
win32_atom = 0;
else
retval = GlobalAddAtom (atom_name);
win32_atom = GlobalAddAtom (atom_name);
retval = GUINT_TO_POINTER (win32_atom);
}
g_hash_table_insert (atom_hash,
g_strdup (atom_name),
GUINT_TO_POINTER (retval));
retval);
}
return retval;
......@@ -88,11 +92,13 @@ gchar *
gdk_atom_name (GdkAtom atom)
{
gchar name[256];
ATOM win32_atom;
switch (atom)
{
case GDK_SELECTION_PRIMARY: return g_strdup ("PRIMARY");
case GDK_SELECTION_SECONDARY: return g_strdup ("SECONDARY");
case GDK_SELECTION_CLIPBOARD: return g_strdup ("CLIPBOARD");
case GDK_SELECTION_TYPE_ATOM: return g_strdup ("ATOM");
case GDK_SELECTION_TYPE_BITMAP: return g_strdup ("BITMAP");
case GDK_SELECTION_TYPE_COLORMAP: return g_strdup ("COLORMAP");
......@@ -102,9 +108,12 @@ gdk_atom_name (GdkAtom atom)
case GDK_SELECTION_TYPE_WINDOW: return g_strdup ("WINDOW");
case GDK_SELECTION_TYPE_STRING: return g_strdup ("STRING");
}
if (atom < 0xC000)
return g_strdup_printf ("#%x", (guint) atom);
else if (GlobalGetAtomName (atom, name, sizeof (name)) == 0)
win32_atom = GPOINTER_TO_UINT (atom);
if (win32_atom < 0xC000)
return g_strdup_printf ("#%x", atom);
else if (GlobalGetAtomName (win32_atom, name, sizeof (name)) == 0)
return NULL;
return g_strdup (name);
}
......
This diff is collapsed.
......@@ -162,9 +162,9 @@ _gdk_events_init (void)
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 @@ gdk_add_client_message_filter (GdkAtom message_type,
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 @@ gdk_check_wm_state_changed (GdkWindow *window)
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 @@ gdk_check_wm_state_changed (GdkWindow *window)
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 @@ gdk_check_wm_state_changed (GdkWindow *window)
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,15 +1373,12 @@ gdk_event_translate (GdkEvent *event,
case PropertyNotify:
GDK_NOTE (EVENTS,
gchar *atom = gdk_atom_name (xevent->xproperty.atom);
g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s",
xevent->xproperty.window,
xevent->xproperty.atom,
atom ? "\"" : "",
atom ? atom : "unknown",
atom ? "\"" : "");
g_free (atom);
);
"\"",
gdk_x11_get_xatom_name (xevent->xproperty.atom),
"\""));
if (window_private == NULL)
{
......@@ -1391,18 +1388,18 @@ gdk_event_translate (GdkEvent *event,
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 +1416,7 @@ gdk_event_translate (GdkEvent *event,
{
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 +1431,9 @@ gdk_event_translate (GdkEvent *event,
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 +1447,9 @@ gdk_event_translate (GdkEvent *event,
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 +1467,7 @@ gdk_event_translate (GdkEvent *event,
{
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 +1477,7 @@ gdk_event_translate (GdkEvent *event,
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 +1504,7 @@ gdk_event_translate (GdkEvent *event,
{
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 +1590,7 @@ gdk_wm_protocols_filter (GdkXEvent *xev,
{
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 +1608,7 @@ gdk_wm_protocols_filter (GdkXEvent *xev,
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 +1624,7 @@ gdk_wm_protocols_filter (GdkXEvent *xev,
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 +1772,7 @@ gdk_event_send_client_message (GdkEvent *event, guint32 xid)
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 +1783,7 @@ gdk_event_send_client_message_to_all_recurse (XEvent *xev,
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 +1796,7 @@ gdk_event_send_client_message_to_all_recurse (XEvent *xev,
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 +1858,7 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
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 +1889,7 @@ gdk_flush (void)
XSync (gdk_display, False);