Detect window focus changes with XCB
问题 I'm writing a program with XCB that needs to detect whenever a window gains or loses focus. So far I have this but it just hangs on the xcb_wait_for_event call, never entering the loop. What am I missing here to grab root events? Or am I just going about this totally wrong and there's a better way than listening to the root? #include <stdio.h> #include <stdlib.h> #include <xcb/xcb.h> int main (int argc, char **argv) { xcb_connection_t* conn = xcb_connect(NULL, NULL); if (xcb_connection_has