Xlib and Xinerama: Ints vs. Shorts?

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jan 6 07:32:12 PST 2012


On 01/06/12 02:44, Christopher Howard wrote:
> This is my first post to this list, so pardon any breach of protocol:
> but I was rather curious about something and this seemed like the only
> place where someone might actually know the answer. Why is it that in
> Xlib.h, the x,y,width,height members are always declared as ints, but in
> Xinerama.h (in XineramaScreenInfo, specifically) they ended up being
> shorts? Naively, it would seem strange that Xinerama heads would be
> restricted to a dimension that could be considerably smaller than that
> allowed for the actual display.

All coordinates and screen/pixmap sizes in the actual protocol are 16-bit
numbers.   The Xlib mapping of those to C types is just generally a series
of mistakes baked into the API 25 years ago.   (Just wait until you find
the places you have to cast 32-bit numbers to "long" and back.)

We hope to have made fewer mistakes in the design and implementation of
the XCB API, but only time will tell.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System




More information about the xorg mailing list