Dmitry Timoshkov wrote:
Hello,
note to Shachar:
this implementation doesn't really work due to "merged" keyboard layouts we have. I.e. since we have Israelian keyboard layout with both english and hebrew characters, after the MappingNotify event we're still using the same keyboard layout with same LCID identifier, and applications receive WM_INPUTLANGCHANGE(REQUEST) with the same, not changed keyboard layout identifier.
You can make it work though, using an ugly workaround:
setxkbmap us wine WINWORD.EXE
type something in Word, then in another xterm and run setxkbmap ru
switch back to Word and continue typing. Word will see the change and kindly reflect that in the status bar.
In order to experiment with Hebrew you need to create a pure Hebrew keyboard layout in Wine, and use 'setxkbmap il'.
Perhaps a way to go is to handle X layout switch notification event and figure out what layout is really used from the merged mapping we currently have. So far I have no an idea how to do that.
I had an idea, but I have not even began to look at it. I'm currently still sharing my time on Wine between the unicows thingy and revamping the BiDi support.
The idea I had, for which I cannot state whether it's feasible or not, is to get the mapping from XKB, and prepare a list (group 0 - US, group 1 - IL, group 2 - RU). Then, whenever we get a "next group" or "prev group", just send out the proper messages. This way, we can also switch keyboard language at an application's whim (I actually have a small snippet of code that does that, if your'e interested).
As far as I see it, using "setxkbmap" with a new layout is akin to entering the keyboard control panel applet and changing the layout, rather than to using "alt-shift".
I fully understand that some applications do that anyhow. In particular, KDE's keyboard switching is based on calling setxkbmap. I think that would still work (though it may send an "settingschanged" message).
Anyhow, your current code (which I have not dived into, yet) should probably go in. It seems to prepare important infrastructure for handling keyboard languages by the X11 driver.
Shachar