ugh.book

(singke) #1
X Myths 139

The color situation is a total flying circus. The X approach to device inde-
pendence is to treat everything like a MicroVAX framebuffer on acid. A
truly portable X application is required to act like the persistent customer in
Monty Python’s “Cheese Shop” sketch, or a grail seeker in “Monty Python
and the Holy Grail.” Even the simplest applications must answer many dif-
ficult questions:


Server: What is your Display?
Client: display = XOpenDisplay("unix:0");
Server: What is your Root?
Client: root = RootWindow(display,DefaultScreen(display));
Server: And what is your Window?
Client: win = XCreateSimpleWindow(display,
root, 0, 0, 256, 256, 1,
BlackPixel(display,DefaultScreen(display)),
WhitePixel(display,DefaultScreen(display)));
Server: Oh all right, you can go on.
(client passes)


Server: What is your Display?
Client: display = XOpenDisplay("unix:0");
Server: What is your Colormap?
Client: cmap = DefaultColormap(display,
DefaultScreen(display));
Server: And what is your favorite color?
Client: favorite_color = 0; / Black. /


/ Whoops! No, I mean: /
favorite_color = BlackPixel(display,
DefaultScreen(display));
Client: / AAAYYYYEEEEE!!/
(client dumps core and falls into the chasm)


Server: What is your display?
Client: display = XOpenDisplay("unix:0");
Server: What is your visual?
Client: struct XVisualInfo vinfo;
if (XMatchVisualInfo(display,DefaultScreen(display),
8, PseudoColor, &vinfo) != 0)
visual = vinfo.visual;
Server: And what is the net speed velocity of an
XConfigureWindow request?
Client: /* Is that a SubStructureRedirectMask or



  • a ResizeRedirectMask?
    */
    Server: What?! how am I supposed to know that? Aaaauuuggghhh!!!!
    (server dumps core and falls into the chasm)

Free download pdf