Skip to content

Avoid XKeycodeToKeysym in KKeyServer::initializeMods

Fabian Vogt requested to merge work/fvogt/bug426684 into master

Xlib functions which work with keyboard mappings have a (Display) internal cache, which needs to be refreshed on mapping changes by calling X(kb)RefreshKeyboardMapping on change notify events.

After Qt switched to XCB, that is no longer happening, and it's also not possible to get to the XEvent needed for triggering the refresh. Switch over to using the XCB equivalent and just load the symbols on every invocation.

BUG: 426684

CC @butirsky

Some other KKeyServer functions are similarly affected. Doing the same change there would however have a noticable effect on performance, as it would have to transfer the entire mapping on each call. The only way to avoid that is by maintaining a cache ourselves, and calling xcb_refresh_keyboard_mapping in a native event filter in a global object, which is annoying to deal with. That's something for a future MR.

Merge request reports