Question

From the XDrawString man page it seems that it aceepts signed 32 bit x and y coordinates

int XDrawString(Display *display, Drawable d, GC gc, int x, int y, char *string, int length);

Note how both x and y are int ( ie: 32 bit signed Integer on gcc/linux2.6-i386 at least )

The problem is when I pass y = 32767 ( 2^15 - 1) the string is drawn in the correct location but anything above this value the string is not drawn.

I suspect that internally 32 bit integers are not used but instead 16 bit signed integers for the coordinates.

Given that the man pages seem to indicate that the function accepts 32 bit integers, is there some compile option that needs to be turned to allow the use of the longer integers? Or is this a limmitation of Xlib?

Was it helpful?

Solution

The X11 protocol does specify 16 bits.

Have a look at the definition for xPolyTextReq in <X11/Xproto.h>

typedef struct {
    CARD8 reqType;
    CARD8 pad;
    CARD16 length B16;
    Drawable drawable B32;
    GContext gc B32;
    INT16 x B16, y B16;         /* items (xTextElt) start after struct */
} xPolyTextReq;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top