Commit 6aa63385 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent e4bbfd9a
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment