[Xcb] xcb_event_loop renaming

Barton C Massey bart at cs.pdx.edu
Wed Jan 9 09:26:29 PST 2008


Thanks for the pointer to Awesome!  It looks, well, really
neat.

Thanks also for the patch! Resubmit with xcb_event_loop()
also renamed as Vincent suggested and we'll take it happily.
(This latter change also means fixing Jamey's sample window
manager and some stuff in util to reflect the renaming.)

	Bart

In message <sa54pdnnhdp.fsf at Orfeo.duckcorp.org> you wrote:
> --=-=-=
> 
> Hello,
> 
> I'm currently  porting Awesome[0] from Xlib  to XCB as  a school project
> for my  bachelor. I discussed  with Vincent about adding  a non-blocking
> xcb_event_loop  on  IRC because  I  had to  write  one  for Awesome  and
> wondered if this kind of function could be added to xcb-util.
> 
> I attached  to this mail the patch  which adds xcb_poll_for_event_loop()
> and also  perform bitwise AND (~0x80)  on the response type  in order to
> get the  event code  (I read this  in the  XCB manual, Vincent  tried to
> explain me what it means but I haven't fully understood yet).
> 
> Regards,
> Arnaud Fontaine
> 
> [0] http://awesome.naquadah.org
> 
> 
> --=-=-=
> Content-Type: text/x-diff
> Content-Disposition: attachment;
>  filename=xcb_util_add_non_blocking_event_loop.diff
> 
> diff --git a/event/events.c b/event/events.c
> index 2900bd3..95fa755 100644
> --- a/event/events.c
> +++ b/event/events.c
> @@ -67,6 +67,18 @@ void xcb_event_loop(xcb_event_handlers_t *evenths)
>  	xcb_generic_event_t *event;
>  	while((event = xcb_wait_for_event(evenths->c)))
>  	{
> +		event->response_type &= ~0x80;
> +		handle_event(evenths, event);
> +		free(event);
> +	}
> +}
> +
> +void xcb_poll_for_event_loop(event_handlers_t *evenths)
> +{
> +	xcb_generic_event_t *event;
> +	while ((event = xcb_poll_for_event(evenths->c)))
> +	{
> +		event->response_type &= ~0x80;
>  		handle_event(evenths, event);
>  		free(event);
>  	}
> diff --git a/event/xcb_event.h b/event/xcb_event.h
> index deb7ba8..d9ea99f 100644
> --- a/event/xcb_event.h
> +++ b/event/xcb_event.h
> @@ -15,6 +15,7 @@ void xcb_free_event_handlers(xcb_event_handlers_t *evenths);
>  xcb_connection_t *xcb_get_xcb_connection(xcb_event_handlers_t *evenths);
>  
>  void xcb_event_loop(xcb_event_handlers_t *evenths);
> +void xcb_poll_for_event_loop(event_handlers_t *evenths);
>  
>  typedef int (*xcb_generic_event_handler_t)(void *data, xcb_connection_t *c, xcb_generic_event_t *event);
>  typedef int (*xcb_generic_error_handler_t)(void *data, xcb_connection_t *c, xcb_generic_error_t *error);
> 
> --=-=-=
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> --=-=-=--


More information about the Xcb mailing list