Problem with XID size on 64 bit systems ?

Graeme Gill graeme2 at argyllcms.com
Mon Aug 14 19:34:23 PDT 2006


I notice in X.h that care is taken to declare XID's to be
32 bit size on the server, but not on the client.

/*
  * _XSERVER64 must ONLY be defined when compiling X server sources on
  * systems where unsigned long is not 32 bits, must NOT be used in
  * client or library code.
  */
#ifndef _XSERVER64
#  ifndef _XTYPEDEF_XID
#    define _XTYPEDEF_XID
typedef unsigned long XID;
#  endif
....
#else
#  include <X11/Xmd.h>
#  ifndef _XTYPEDEF_XID
#    define _XTYPEDEF_XID
typedef CARD32 XID;
#  endif
....
#endif


This seems to create a problem with the following idiom in
client code:

            XChangeProperty(
                mydisplay, mywindow,
                XA_WM_TRANSIENT_FOR,        /* Property */
                XA_WINDOW,                  /* Type */
                sizeof(Window) * 8,         /* format */
                PropModeReplace,            /* Change mode */
                (char *)(&window),          /* Window XID */
                1                           /* Number of elements of data */
            );
a format value of 64 not being legal.

If the format is hard coded to be 32, then this will (presumably)
work on little endian systems, and break on big endian systems.

Has this issue been covered and resolved previously ?

What is the reason for leaving client size XID 64 bit on 64 bit
systems ?

Graeme Gill.



More information about the xorg mailing list