Commit e7e6d9e4f527fdf26d200496175842474c62b3d4
A patch sent to me by "M. Vefa Bicakci" <bicave (at) superonline.com> who
discussed it with bhughes on irc.
It fixes the fact that qt's shortcuts currently do not respect a change to
x11's keymap group. Configure x11 to have two keyboard layouts
setxkbmap -layout us,de
setxkbmap -option -option grp:shifts_toggle
The second command allows switching with Shift+Shift between them. It's
easier to set this up in kde's "kcmshell4 keyboard_layout".
1. Configure a shortcut for Ctrl+y (in the de,us example) or any other key
that changes it's location when switching from one layout to the other. In
my example the y and z key change their place when switching between
de,us.
2. Type y (see either y or z), Trigger Ctrl+y, Everything is ok.
3. Switch Layouts.
4. Type the key formerly known as y. You should see either y or z
depending on your start point. It's clearly not the same as under 1.,
Trigger Ctrl+y, The action still triggers. With this patch applied you
would have to type ctrl+z to trigger the action.
Mike
| |   |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | enum { MaxBits = sizeof(uint) * 8 }; |
| enum { AlternativeKeymapMask1 = 1 << 13 }; |
| enum { AlternativeKeymapMask2 = 1 << 14 }; |
| 286 | 288 | static QString translateKeySym(KeySym keysym, uint xmodifiers, |
| 287 | 289 | int &code, Qt::KeyboardModifiers &modifiers, |
| 288 | 290 | QByteArray &chars, int &count); |
| … | … | |
| 299 | 299 | // always use them when determining the baseKeySym) |
| 300 | 300 | KeySym baseKeySym; |
| 301 | 301 | uint consumedModifiers; |
| if (!XkbLookupKeySym(X11->display, xkeycode, (xmodifiers & (LockMask | qt_num_lock_mask)), |
| &consumedModifiers, &baseKeySym)) |
| if (!XkbLookupKeySym(X11->display, xkeycode, |
| (xmodifiers & ~(ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask)), |
| &consumedModifiers, &baseKeySym)) |
| 304 | 305 | return QList<int>(); |
| 305 | 306 | |
| 306 | 307 | QList<int> result; |
| … | … | |
| 338 | 338 | for (int j = 0; j < num1Bits; ++j) { |
| 339 | 339 | if (i & (1 << j)) |
| 340 | 340 | val |= (1 << pos1Bits[j]); |
| } |
|
| if (xmodifiers & AlternativeKeymapMask1) { |
| val |= AlternativeKeymapMask1; |
| } |
| if (xmodifiers & AlternativeKeymapMask2) { |
| val |= AlternativeKeymapMask2; |
| 341 | 348 | } |
| 342 | 349 | |
| 343 | 350 | if ((xmodifiers & val) != val) |