[Xcb] How does one detect key repeat events in XCB?

Michael Stapelberg michael+xcb at stapelberg.de
Sat Jan 28 01:56:52 PST 2012


Hi Nicholas,

Excerpts from Nicholas Allen's message of 2012-01-27 22:51:56 +0000:
> I would like to know how to detect if a key release event is a real key 
> release event by the user or a repeated key press/release event sent by 
> the X server. After searching for a solution for this it seems one needs 
> to check if the next event in the queue is the same key as the release 
> event and is a press with the same time then it is a repeat. To do this 
> with Xlib you need to call XPeekNextEvent but I can't find the 
> equivalent for XCB. What is the correct way to do this?
You can have a look at this code in i3, which does roughly what you want:
http://code.stapelberg.de/git/i3/tree/src/floating.c#n469
It handles MotionNotify events, but skips a lot of them, using a combination of
xcb_wait_for_event and xcb_poll_for_event.

Best regards,
Michael


More information about the Xcb mailing list