[Xcb] question about the response_type of an event

Jamey Sharp jamey at minilop.net
Wed Apr 2 09:41:53 PDT 2008


On Sat, Mar 08, 2008 at 11:33:23PM +0100, Vincent Torri wrote:
> On Sat, 8 Mar 2008, Vincent Torri wrote:
> > in ecore_xcb, I have something strange: when I get any event in my event
> > loop, xcb_poll_for_event() returns an event with response_type being 0.
> 
> actually, it's an error that comes from a previous call. ...
> 
> is it correct to cast the generic event to a generic error ?

Yes, that's correct. Both events and errors go on the event queue in
XCB, unlike in Xlib, and if the response type is 0 then you need to cast
it to an xcb_generic_error_t pointer to find out what kind of error it
is.

If you use the _checked variant of a request, then the error won't go in
the event queue, but will be returned to you when you call
xcb_request_check, or the appropriate xcb_*_reply function, depending on
whether the request should have had a reply. If you have reason to
believe a request might return an error, and you want to handle the
error specially, you should use this approach; and in that case, you
don't have to cast to xcb_generic_error_t, because those functions
already return that type.

> In my case, I get 16 (bad length). Is it really bad ?

That "shouldn't happen". You need to find out what request caused the
error (the full_sequence field in the generic error may help). It could
be that our XML description of that request is wrong.

Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20080402/2d5762e0/attachment-0001.pgp 


More information about the Xcb mailing list