[comp.windows.x] XQueryColors

tek@CS.UCLA.EDU (07/15/88)

[ line eating food ]

How do you use the Xlib function XQueryColor(s) in X11 R2?

More specifically, why doesn't this function return "Status"?

I assume that this function waits for a reply. Otherwise, how can you
be sure that your XColor structures have been filled in. So what
happens when an error occurs? The Xlib error handler kicks in, of
course. But determining that an error occurred via the error handler
in client code is not very convenient.

So why not just return a "Status" (like most other "query" type
functions)?  Then it's easy to tell what happened.

If I have missed something obvious here, let me sheepishly appolgize
in advance.





-ted		ARPAnet: tek@penzance.cs.ucla.edu 
		UUCP:    ...!ucbvax!ucla-cs!tek

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/15/88)

    Date: 14 Jul 88 17:39:46 GMT
    From: tek@CS.UCLA.EDU

    How do you use the Xlib function XQueryColor(s) in X11 R2?
    More specifically, why doesn't this function return "Status"?

Xlib takes the attitude that "programmer errors" are not returned
via a status condition, they go through the error handler.  Only
"expected" errors on synchronous calls are reflected in status.
Since the only errors from XQueryColors are from passing bogus
arguments, these are viewed as programmer errors.  One can, of
course, construct counter-examples to any such rule, but that's
the reasoning behind the interface.