does XkbSetMap affect XTestFakeKeyEvent?

Daiki Ueno ueno at
Wed Oct 24 03:10:40 PDT 2012


I'm currently looking into Caribou (an on-screen keyboard software)[1]
and found that its keysym replacement logic does not work reliably[2].

That code basically does the following:

(1) assign a keysym to some unused keycode (like keycode 246, which
    XF86WLAN is assigned here) with XkbSetMap
(2) send key press event using XTestFakeKeyEvent to get the keysym typed

Is this supposed to work?  After (1), I could type the new keysym with
physical keyboard, but couldn't with XTestFakeKeyEvent.  If I change the
mapping with XChangeKeyboardMapping instead of XkbSetMap, it seems to
work with both physical and virtual keyboard.

I'm attaching a test program which changes keysym mapping on 'a' key
(keycode 38) on US keyboard and then send key press.

The original code can be found at:


Daiki Ueno
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test-xkb-xtest.c
URL: <>

More information about the xorg mailing list