keymap and Xsync

viollet.benoit at free.fr viollet.benoit at free.fr
Mon Jul 19 08:23:55 PDT 2010



>   locale(LC_ALL,"");
>   ...
>   keysym = XKeycodeToKeysym (dpy, keycode,0);
>   std::cout << (int) keycode << " " << (int) keysym << std::endl;
>   XSync (dpy, False);
>   keysym = XKeycodeToKeysym (dpy, keycode,0);
>   std::cout << (int) keycode << " " << (int) keysym << std::endl;
> 
> gives
> 24 97
> 24 113
> 
> So, Xsync changes the keymap from "fr" to "us". But when I add at the beginning: system("setxkbmap fr"), it works.
> 24 97
> 24 97
> 
> What can I do ? 
X
Does it work with the XKB version of the call:
  keysym = XkbKeycodeToKeysym (dpy, keycode,0, 0);
n
-->
Thank you.
The behaviour of the two function (XKeycode... and XkbKeycode...) is the same. The problem is not the function, but the behaviour of Xsync, which change the keymap. At the beginning, the keymap is "fr", after Xsync it becomme and rest "en". But when I execute "system("setxkbmap fr") before, it works.
What is painful is that the bug is random, one time, it works, one time it don't work. But the setxkbmap fr hack works all the time.
Maybe, the solution is to "refresh" the config of the keymap at the beginning of the program like with XkbRefreshKeyboardMapping but I don't understand how it works.

greetings.
Sorry for my english.


More information about the xorg-devel mailing list