
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 the library is usable. One would think that with a "Stability: provisional" library every function has been run successfully at least once, but I can't imagine that this is the case here. Is there even a working Haskell equivalent of 'basicwin' from the Xlib Programming Manual to test things out? This would also be a helpful example for users. Regards, Frederik -- http://ofb.net/~frederik/

FYI, I'm not actually running into any other problems in my application (although as mentioned I'm only using basic functionality). Thanks to Alastair Reid and whoever else contributed to the bindings. Extra features such as waitForEvent are especially appreciated. Should I submit a patch to fix the Status issue or have I described the problem well enough? Frederik On Sat, May 07, 2005 at 01:05:12PM -0700, Frederik Eaton wrote:
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 the library is usable. One would think that with a "Stability: provisional" library every function has been run successfully at least once, but I can't imagine that this is the case here. Is there even a working Haskell equivalent of 'basicwin' from the Xlib Programming Manual to test things out? This would also be a helpful example for users.
Regards,
Frederik
-- http://ofb.net/~frederik/ _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On Sun, May 08, 2005 at 03:38:03PM -0700, Frederik Eaton wrote:
FYI, I'm not actually running into any other problems in my application (although as mentioned I'm only using basic functionality). Thanks to Alastair Reid and whoever else contributed to the bindings. Extra features such as waitForEvent are especially appreciated. Should I submit a patch to fix the Status issue or have I described the problem well enough?
You have. The fix is in CVS, and should be in GHC 6.4.1. BTW this is quite an old library (and bug). Its main use has been to support the HGL package, which doesn't use these 13 functions.

Frederik Eaton wrote:
FYI, I'm not actually running into any other problems in my application (although as mentioned I'm only using basic functionality). Thanks to Alastair Reid and whoever else contributed to the bindings. Extra features such as waitForEvent are especially appreciated. Should I submit a patch to fix the Status issue or have I described the problem well enough?
Ross fixed this yesterday (in HEAD and STABLE), I believe... Cheers, S.
participants (3)
-
Frederik Eaton
-
ross@soi.city.ac.uk
-
Sven Panne