I'm trying to implement a simple X11 key grabber in C for window switching with Alt-Tab etc. I can use the function XSelectInput to handle keyboard events for a specific window:
XSelectInput(display, window, KeyPressMask | KeyReleaseMask);
How can I receive "global" keyboard events regardless of which window is focused?