[Xcb] open Connection
Ian Osgood
iano at quirkster.com
Sun Jun 4 17:22:36 PDT 2006
On Jun 4, 2006, at 9:37 AM, Florent Monnier wrote:
> Hi,
> First thanks for having explain me where to find the doc about the
> specs of
> the X protocol. I've started to read it, and trying to understand
> it so to
> begin I'm now trying to open the connection with the server.
>
> Here is the piece of doc describing this part that I follow:
> http://www.linux-nantes.org/~fmonnier/OCaml/Xlib/init-X/protocol.html
- first the byte order character (which looks ok), then a pad byte
(missing)
> - first I put the CARD16 11, then 6
> - then I put two strings containing one char 0
> => then I'm trying to listen the answer, but the function which
> gets input
> never returns.
Surely there are routines in ocaml to output integers or entire
structures at once.
If not, you want to use output_byte instead, which does the (land
255) for you.
For efficiency, you will eventually want to lay out entire Buffers of
structures,
then write the whole buffer at once using output_buffer. (I hope. I'm
not
sure what the restrictions are on the chars contained in a string/
buffer.)
You will eventually need access to actual 32-bit integers (the Int32
module).
It appears that the default ocaml int has less precision.
I guess the Marshal module is of no use, since it uses an Ocaml-
specific format.
Maybe you could also look at the source for the GraphicsX11 and
Pervasives
modules for inspiration.
> I have tryed to read at the code of the XopenDisplay from the Xlib,
> and its
> equivalent in the XCB, but I quite don't understand everything
> since as you
> know I'm not a C programmer.
Knowledge of C will be required to complete your project, in my opinion.
Too much X behaviour is best described in source.
You should model your code after the XCB internals, not the Xlib
internals, if you wish to retain your sanity. I presume you have already
obtained the xcb 0.9 package or pulled xcb from the GIT repository.
Look in
xcb/src/xcb_conn.c
for functions XCBConnectToFD(), write_setup() and read_setup().
Look in header
xcb/src/xcb_types.h
for structure XCBSetupReq.
ERROR: There is a pad byte that comes after the byte order char.
Look at the values for X_PROTOCOL* in
xcb/src/xcb.h
ERROR: There you find them defined as 11 and 0, not 11 and 6.
> Well I don't know, maybe someone here could see the beginner error
> I'm making?
ERROR: Well, you are only sending 3 bytes of a CARD32, but that
doesn't affect this problem.
If you still have problems, maybe set set_binary_mode_out out_channel
true.
> And you have told me that some of you were ML users in the past, so
> for those
> here is my first attempt to open the connection:
> http://www.linux-nantes.org/~fmonnier/OCaml/Xlib/init-X
Very pretty source formatting!
Ian
(Note: I am not an ocaml expert, I just read the documentation at
http://caml.inria.fr/ )
> Thanks in advance
> Florent
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/xcb/attachments/20060604/cf48b560/attachment.html
More information about the Xcb
mailing list