Discrepancy between XCB and X11 MappingNotify
qqdpv04z at thepsauce.anonaddy.com
qqdpv04z at thepsauce.anonaddy.com
Thu Apr 3 18:13:53 UTC 2025
Hello, I got inconsistent behavior between X11 and XCB which confuses me.
First, I create a connection with xcb_connect() and then a window using
xcb_create_window() and then I simply listen for MappingNotify events using
xcb_wait_for_event().
When using the command "setxkbmap", I receive a MappingNotify event as expected.
Now I tried the same but using libX11:
I open a connection using XOpenDisplay() and use XCreateSimpleWindow() to get a
window. I then listen to events using XNextEvent().
When using "setxkbmap" now, I get no event.
This looks especially awkward when 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-current-new-keyboard-layout-on
One answer suggested to use XKeysymToKeycode(display, XK_F1) to "cache the
modifier and keymap information". This makes the X11 code work but does not work
for the x11-xcb case. And in addition, a few more MappingNotify events arrive
compared to the xcb only code.
I really want to know what could cause these discrepancies.
More information about the Xcb
mailing list