[PATCH:libXt 2/2] Pass const char ** names to XInternAtoms if Xlib supports it
Alan Coopersmith
alan.coopersmith at oracle.com
Mon Dec 13 17:22:59 PST 2010
Uses #ifdefs from Xlib fix for bug 32098
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
src/Selection.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/Selection.c b/src/Selection.c
index a138c8b..f2cd15c 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -68,6 +68,8 @@ in this Software without prior written authorization from The Open Group.
*/
+#define XINTERNATOMS_WANT_CONST_NAMES /* must come before Xlib.h is included */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -77,6 +79,12 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xatom.h>
#include <stdio.h>
+#ifdef XINTERNATOMS_HAVE_CONST_NAMES /* must come after Xlib.h is included */
+# define ATOMS_NAME_CAST(n) (n) /* no casting needed */
+#else
+# define ATOMS_NAME_CAST(n) ((char **) (n))
+#endif
+
void _XtSetDefaultSelectionTimeout(
unsigned long *timeout)
{
@@ -174,7 +182,7 @@ static PropList GetPropList(
{
PropList sarray;
Atom atoms[4];
- static char* names[] = {
+ static const char* names[] = {
"INCR",
"MULTIPLE",
"TIMESTAMP",
@@ -188,7 +196,7 @@ static PropList GetPropList(
XtPerDisplay pd = _XtGetPerDisplay(dpy);
sarray = (PropList) __XtMalloc((unsigned) sizeof(PropListRec));
sarray->dpy = dpy;
- XInternAtoms(dpy, names, 4, FALSE, atoms);
+ XInternAtoms(dpy, ATOMS_NAME_CAST(names), 4, FALSE, atoms);
sarray->incr_atom = atoms[0];
sarray->indirect_atom = atoms[1];
sarray->timestamp_atom = atoms[2];
--
1.7.3.2
More information about the xorg-devel
mailing list