On Tue, 30 Jul 2002, ding jj wrote:

> I am trying to use RECORD extension, but there is  something I can't
> understand clearly. When I call XRecordEnableContext and do some operation
> in machine, XRecordInterceptProc function will be invoked. Now about
> structure XRecordInterceptData in XRecordInterceptProc, there is a member
> "data" in it, and I just don't know what the "data" contain(unsigned char *
> data). How can I get what I need from data?

First, you need to determine the type of data your intercept routine
is receiving.  Hopefully, your prototype for the intercept routine
is something like:

    static void
    recordIntercept(XPointer closure, XRecordInterceptData *recData);

Now, if you look at the recData->category it will tell you whether
the intercepted data is from the X server, from a client, etc, etc
(check the X11/extensions/record.h and X11/extensions/recordstr.h
header files for details on what to look for in recData->category).

Once you know that, you know how to proceed.  I mean, if the data is
from the server, check the protocol book and see what the server can
send (events, etc.).  If the data is from a client, check the protocol
to see what the client can send.


So, for processing the server messages, you would extract the
information via something like:

    xEvent *serverEvent = (xEvent *) recData->data;

While the processing of the client requests would require initial
casting like:

    xReq *clientReq = (xReq *) recData->data;

Again, check the header files to see what the xEvent and xReq types
contain, and how to further extract useful data out of them. :-)

Definitely read the docs on RECORD extension before starting.


> And are there any good examples about RECORD extension?

At one point I discovered a test program for the RECORD extension,
but I seem to have misplaced it.  However, it wasn't very useful to
me, because by the time I found it, I already had everything mostly
working, and the things giving me problems were not explained in the
test program.


> Thanks in Advance!

Sure thing.


========================================================================
 Nikola Miljanic [Nick] |                    | Metro Link, Inc.
 [EMAIL PROTECTED]     |                    | http://www.metrolink.com
========================================================================
Experience is what you get when you don't get what you want


_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to