[Xcb] Tiny cleanup patch that removes some code duplication

Ian Osgood iano at quirkster.com
Sun Sep 14 08:40:58 PDT 2008


On Sep 13, 2008, at 1:52 PM, Henning Sten wrote:

> Hi Julien et al,

...

> 2) Also, I've seen code like this on several places (see below). In  
> this context, why is 0x7f used? Is there a constant for this  
> instead or maybe the API could be made a little bit clear/readable?
>
>       if ((e = xcb_poll_for_event (f->xcb.c)))
>         {
>           switch (e->response_type & 0x7f)
>
>
> Thanks,
> HS

 From the X11R6 protocol document: "The most-significant bit in this  
code is set if the event was generated from a SendEvent request."

Most of the time, event handling code doesn't care where the event  
came from. Agreed that it should be a function macro, something like  
this:

#define EVENT_RESPONSE_TYPE(e) (e->response_type & ~0x80)
#define EVENT_SENT(e)          (e->response_type &  0x80)

Ian




More information about the Xcb mailing list