[hoelz@wisc.edu: [Haskell] Haskell Xlib bindings]

This question is best asked on the libraries@haskell.org list, so I'll
forward it there. Failing that, best to contact the maintainer of the
xlib package.
Cheers,
Don
----- Forwarded message from Rob Hoelz

Rob Hoelz
My question is this: Why do the Haskell Xlib bindings have no way to extract the property event from an event pointer?
For example, the following functions are available:
get_KeyEvent, get_ButtonEvent, get_MotionEvent, etc.
but there's no get_PropertyEvent.
Why was this left out? It seems pretty critical to the functionality of an Xlib program to someone who's been programming in C with Xlib for quite some time.
It wasn't left out, it just wasn't put in, like a lot of other things. If you have a list of stuff you need, it can be added.

Ross Paterson
Rob Hoelz
wrote: My question is this: Why do the Haskell Xlib bindings have no way to extract the property event from an event pointer?
For example, the following functions are available:
get_KeyEvent, get_ButtonEvent, get_MotionEvent, etc.
but there's no get_PropertyEvent.
Why was this left out? It seems pretty critical to the functionality of an Xlib program to someone who's been programming in C with Xlib for quite some time.
It wasn't left out, it just wasn't put in, like a lot of other things. If you have a list of stuff you need, it can be added.
Actually, I wouldn't mind doing it myself. Are the Haskell libs compiler-specific, or central? Either way, is there a CVS/subversion/git repository I can check out from?

hoelz:
Ross Paterson
wrote: Rob Hoelz
wrote: My question is this: Why do the Haskell Xlib bindings have no way to extract the property event from an event pointer?
For example, the following functions are available:
get_KeyEvent, get_ButtonEvent, get_MotionEvent, etc.
but there's no get_PropertyEvent.
Why was this left out? It seems pretty critical to the functionality of an Xlib program to someone who's been programming in C with Xlib for quite some time.
It wasn't left out, it just wasn't put in, like a lot of other things. If you have a list of stuff you need, it can be added.
Actually, I wouldn't mind doing it myself. Are the Haskell libs compiler-specific, or central? Either way, is there a CVS/subversion/git repository I can check out from?
Great! You can get most Haskell software via darcs repositories, (http://darcs.net) , and X11 is no exception: $ darcs get http://darcs.haskell.org/packages/X11 Copying patch 17 of 99... General information for developing Haskell libraries is available here: http://haskell.org/haskellwiki/How_to_write_a_Haskell_program and covers the toolchain and best practices. Cheers, Don

Hello, I have some code that adds support for ClientMessage, peekXButtonEvent, and XGetAtomName: http://www.n-heptane.com/nhlab/repos/haskell-glx/ClientMessage.hsc This code is in reasonably good shape (and is only a few lines anyway). I can follow the library submission guidelines: http://haskell.org/haskellwiki/Library_submissions unless there is a better way. j.

On Sun, Feb 04, 2007 at 03:52:36PM -0800, Jeremy Shaw wrote:
I have some code that adds support for ClientMessage, peekXButtonEvent, and XGetAtomName:
http://www.n-heptane.com/nhlab/repos/haskell-glx/ClientMessage.hsc
This code is in reasonably good shape (and is only a few lines anyway).
I can follow the library submission guidelines:
http://haskell.org/haskellwiki/Library_submissions
unless there is a better way.
X11 is a fairly peripheral library, so there's no need for that -- just send a patch against the X11 darcs repository, e.g. to me.

At Mon, 5 Feb 2007 00:02:18 +0000, Ross Paterson wrote:
On Sun, Feb 04, 2007 at 03:52:36PM -0800, Jeremy Shaw wrote:
I have some code that adds support for ClientMessage, peekXButtonEvent, and XGetAtomName:
http://www.n-heptane.com/nhlab/repos/haskell-glx/ClientMessage.hsc
This code is in reasonably good shape (and is only a few lines anyway).
I can follow the library submission guidelines:
http://haskell.org/haskellwiki/Library_submissions
unless there is a better way.
X11 is a fairly peripheral library, so there's no need for that -- just send a patch against the X11 darcs repository, e.g. to me.
Hello, I have been working on this a bit, but ran into a problem, Xlib does not currently have any support for XVisualInfo. Is this intentional? Or, just another thing that has not been done yet? Two of the functions in the glx bindings take or return XVisualInfo as a parameter: foreign import ccall unsafe "glXChooseVisual" c_glXChooseVisual :: Display -> ScreenNumber -> AttribList -> IO XVisualInfo foreign import ccall unsafe "glXCreateContext" c_glXCreateContext :: Display -> XVisualInfo -> Context -> Bool -> IO Context But, it in the existing Xlib bindings, the XVisualInfo stuff has been omitted: -- XGetVisualInfo omitted -- XMatchVisualInfo omitted In addition to passing around pointers to XVisualInfo, I also needed to access three members of the XVisualInfo structure: -- * Access functions for members of XVisualInfo visual :: XVisualInfo -> Visual visual (XVisualInfo xvi) = Visual ((#ptr XVisualInfo, visual) xvi) depth :: XVisualInfo -> IO Int depth (XVisualInfo xvi) = (#peek XVisualInfo, depth) xvi visualId :: XVisualInfo -> IO VisualID visualId (XVisualInfo xvi) = ((#peek XVisualInfo, visualid) xvi) This 'visual' code no longer works, because the Visual constructor is no longer exported. However, I am thinking all this stuff belongs in the Xlib bindings and not the GLX bindngs anway. j.
participants (4)
-
dons@cse.unsw.edu.au
-
Jeremy Shaw
-
Rob Hoelz
-
Ross Paterson