[gtk+] Fix handling of GDK_NONE
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Fix handling of GDK_NONE
- Date: Sun, 3 May 2009 21:40:19 -0400 (EDT)
commit 6aa63385789fd28e61eb4de05312e2f1316cf6d0
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 3 21:38:54 2009 -0400
Fix handling of GDK_NONE
Don't intern "NONE" and warn if GDK_NONE is converted to an
X atom. Problem pointed out in bug 580511.
---
gdk/x11/gdkproperty-x11.c | 16 +++++++++-------
gdk/x11/gdkselection-x11.c | 5 ++++-
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
index 36b8e9f..116f47d 100644
--- a/gdk/x11/gdkproperty-x11.c
+++ b/gdk/x11/gdkproperty-x11.c
@@ -44,7 +44,7 @@ static GHashTable *virtual_atom_hash;
static const gchar xatoms_string[] =
/* These are all the standard predefined X atoms */
- "NONE\0"
+ "\0" /* leave a space for None, even though it is not a predefined atom */
"PRIMARY\0"
"SECONDARY\0"
"ARC\0"
@@ -120,12 +120,12 @@ static const gchar xatoms_string[] =
;
static const gint xatoms_offset[] = {
- 0, 5, 13, 23, 27, 32, 39, 48, 57, 64, 76, 88,
- 100, 112, 124, 136, 148, 160, 169, 174, 182, 189, 195, 205,
- 222, 236, 249, 262, 278, 291, 305, 317, 324, 333, 340, 351,
- 360, 378, 391, 404, 412, 428, 442, 456, 466, 477, 487, 497,
- 511, 525, 537, 549, 568, 588, 605, 623, 636, 645, 656, 663,
- 674, 685, 695, 702, 712, 724, 734, 745, 754, 771
+ 0, 1, 9, 19, 23, 28, 35, 44, 53, 60, 72, 84,
+ 96, 108, 120, 132, 144, 156, 165, 170, 178, 185, 189, 201,
+ 218, 232, 245, 258, 274, 287, 301, 313, 320, 329, 336, 347,
+ 356, 374, 387, 400, 408, 424, 438, 452, 462, 473, 483, 493,
+ 507, 521, 533, 545, 564, 584, 601, 619, 632, 641, 652, 659,
+ 670, 681, 691, 698, 708, 720, 730, 741, 750, 767
};
#define N_CUSTOM_PREDEFINED 1
@@ -189,6 +189,7 @@ gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
Atom xatom = None;
g_return_val_if_fail (GDK_IS_DISPLAY (display), None);
+ g_return_val_if_fail (atom != GDK_NONE, None);
if (display->closed)
return None;
@@ -292,6 +293,7 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
GdkAtom virtual_atom = GDK_NONE;
g_return_val_if_fail (GDK_IS_DISPLAY (display), GDK_NONE);
+ g_return_val_if_fail (xatom != None, GDK_NONE);
if (display->closed)
return GDK_NONE;
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index fd482e2..6045dad 100644
--- a/gdk/x11/gdkselection-x11.c
+++ b/gdk/x11/gdkselection-x11.c
@@ -404,7 +404,10 @@ gdk_selection_send_notify_for_display (GdkDisplay *display,
xevent.requestor = requestor;
xevent.selection = gdk_x11_atom_to_xatom_for_display (display, selection);
xevent.target = gdk_x11_atom_to_xatom_for_display (display, target);
- xevent.property = gdk_x11_atom_to_xatom_for_display (display, property);
+ if (property == GDK_NONE)
+ xevent.property = None;
+ else
+ xevent.property = gdk_x11_atom_to_xatom_for_display (display, property);
xevent.time = time;
_gdk_send_xevent (display, requestor, False, NoEventMask, (XEvent*) & xevent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]