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?
-
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;
hhafez : Is there anyway around this?Alnitak : Not that I know of - looking at the Xlib source suggests that all coordinates are 16 bit. I can't see why you'd need coordinates larger than that...hhafez : I need it ;) It's not an absolute coordinate on a screen but on a scrolling lsit of widgetsAlnitak : that's a *big* list of widgets!hhafez : yeah a few thousand, it's a customer requirment to able to display all entries in a window :/ not practical to use ever, but it's in the contract and will be tested.Alnitak : In that case, use separate scrollbar widgets that aren't part of a scrolling viewport, and redraw only those entries that are visible based on the scrollbar position.
0 comments:
Post a Comment