[gtk+] Avoid warnings in atom conversion
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Avoid warnings in atom conversion
- Date: Fri, 5 Jun 2009 22:39:22 -0400 (EDT)
commit 4b16b875db66c72003606c4199b23899ed451e78
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 5 22:36:48 2009 -0400
Avoid warnings in atom conversion
Cave in and revert to silently converting GDK_NONE to None.
Fixes bug 580511.
---
gdk/x11/gdkproperty-x11.c | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
index 116f47d..c415dee 100644
--- a/gdk/x11/gdkproperty-x11.c
+++ b/gdk/x11/gdkproperty-x11.c
@@ -173,37 +173,40 @@ lookup_cached_xatom (GdkDisplay *display,
/**
* gdk_x11_atom_to_xatom_for_display:
* @display: A #GdkDisplay
- * @atom: A #GdkAtom
- *
+ * @atom: A #GdkAtom, or %GDK_NONE
+ *
* Converts from a #GdkAtom to the X atom for a #GdkDisplay
- * with the same string value.
- *
- * Return value: the X atom corresponding to @atom.
+ * with the same string value. The special value %GDK_NONE
+ * is converted to %None.
+ *
+ * Return value: the X atom corresponding to @atom, or %None
*
* Since: 2.2
**/
Atom
-gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
- GdkAtom atom)
+gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
+ GdkAtom atom)
{
Atom xatom = None;
-
+
g_return_val_if_fail (GDK_IS_DISPLAY (display), None);
- g_return_val_if_fail (atom != GDK_NONE, None);
+
+ if (atom == GDK_NONE)
+ return None;
if (display->closed)
return None;
-
+
xatom = lookup_cached_xatom (display, atom);
-
+
if (!xatom)
{
char *name;
-
+
g_return_val_if_fail (ATOM_TO_INDEX (atom) < virtual_atom_array->len, None);
name = g_ptr_array_index (virtual_atom_array, ATOM_TO_INDEX (atom));
-
+
xatom = XInternAtom (GDK_DISPLAY_XDISPLAY (display), name, FALSE);
insert_atom_pair (display, atom, xatom);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]