Discrepancy between XCB and X11 MappingNotify
[email protected] Thu, 03 Apr 2025 18:13:53 +0000
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
Hello, I got inconsistent behavior between X11 and XCB which confuses me.= First, I create a connection with xcb_connect() and then a window usi= ng xcb_create_window() and then I simply listen for MappingNotify events = using xcb_wait_for_event(). When using the command "setxkbmap", I recei= ve a MappingNotify event as expected. Now I tried the same but using l= ibX11: I open a connection using XOpenDisplay() and use XCreateSimpleWind= ow() to get a window. I then listen to events using XNextEvent(). When = using "setxkbmap" now, I get no event. This looks especially awkward w= hen using x11-xcb where you have an XCB style loop but use XOpenDisplay()= . The code looks the same but no MappingNotify. https://stackoverflow.= com/questions/35569562/how-to-catch-keyboard-layout-change-event-and-get-cu= rrent-new-keyboard-layout-on One answer suggested to use XKeysymToKeycode= (display, XK_F1) to "cache the modifier and keymap information". This mak= es the X11 code work but does not work for the x11-xcb case. And in addit= ion, a few more MappingNotify events arrive compared to the xcb only code= . I really want to know what could cause these discrepancies.