problem with xlib binding
Frederik Eaton
frederik at ofb.net
Sat May 7 14:22:07 EDT 2005
Hi,
Hmm, have the new xlib bindings been tested? For instance, when I run
the following program:
----------------------------------------------------------------
module Main where
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Display
main :: IO ()
main = do
display <- openDisplay ""
root <- rootWindow display $ defaultScreen display
getGeometry display root
closeDisplay display
return ()
----------------------------------------------------------------
It prints out:
xtest: user error (Error bad status 1 raised in function getGeometry)
>From the code it looks like the haskell getGeometry is calling
XGetGeometry - which has type
Status XGetGeometry(...)
- and interpreting the 1 return value as an error (via the internal
wrapper 'throwUnlessSuccess' which takes 0 for success).
But the Xlib Programming Manual says "Some errors, such as failure to
open a font, are indicated by return values of type Status on the
appropriate routine ... The returned values are *zero* on failure and
*nonzero* on success." (emphasis added)
So unless I'm really misinterpreting things, the binding to each and
every one of the 13 functions that uses 'throwUnlessSuccess' is wrong.
Well, before I realized this I'd gone ahead and written a reasonably
significant program against the binding assuming that at least the
basics would work, but it seems there is some distance to go before it
is usable. One would think that with a "Stability: provisional"
library at least every function has been run successfully once, but I
can't imagine that this is the case. Is there even a working Haskell
version of 'basicwin' from the Xlib Programming Manual? This would
also be a helpful example for users.
Thanks,
Frederik
--
http://ofb.net/~frederik/
More information about the Glasgow-haskell-bugs
mailing list