[Xcb] Callback based event handling
Uli Schlachter
psychon at znc.in
Thu Feb 23 03:26:01 PST 2012
On 23.02.2012 10:51, Erik Karlsson wrote:
> Hello!
>
> I just returned to a small project of mine which used the callback
> based event handling of xcb-event.
>
> This has been removed as of commit
> 81c62e7a04213abefa1ea82819887aaaa3c31a74.
>
> The commit message discourages use of this library, and I then wonder,
> what is the preferred method of handling XCB events?
You could just reimplement that code yourself. It is just a simple switch()
based on the event type.
For an example of how something else was handled, here is the corresponding
commit for the awesome window manager (The chunk in event.c might be the most
interesting to you):
http://git.naquadah.org/?p=awesome.git;a=commitdiff;h=58bb6016580584c59b0ea3a956715ec8a5eb604e
For getting events, you would then call libxcb's function, e.g.
xcb_poll_for_event() (possibly in a loop) instead of
xcb_event_poll_for_event_loop().
As you see from that commit, the xcb-event library didn't actually save much
code and due to the indirection it was certainly slower. Hence it was removed.
Uli
--
"Engineering - where the semi-skilled laborers execute the vision
of those who think and dream. Hello Oompa-Loompas of science."
More information about the Xcb
mailing list