Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.5.2
-
None
-
Change-Id: I04d2c2ad7049df7420999816154605848fa670e1
Description
Platform: system with X11 server support.
Note that Qt shortcuts work as expected if only the dvorak keyboard map is applied eg:
setxkbmap dvorak
however doing the following:
setxkbmap us,us -variant ,dvorak -option shifts_toggle
and then press both shift keys to switch to Dvorak keymap group, the keyboard
shortcuts in Qt4 applications continue to act as if the regular US keymap group were active.
Steps to reproduce using the examples/mainwindows/menus/menus
program.
1) Start the menus example
2) In a terminal window, run the following command
setxkbmap us,us -variant ,dvorak -option shifts_toggle
3) Now, press Alt-F. You should see that the file menu is activated.
4) Press escape to close the file menu.
5) Now, switch the keymap group to Dvorak by pressing both shift keys
at the same time.
6) If you would like, start another terminal or text editor and observe
that the location of the F key is different in the Dvorak keymap group.
7) Now go to the menu example program and press the same key as you did
in step 3. You will see that the file menu opens again. However, this
shouldn't happen, as the F key's location is different in the Dvorak
keymap group.
The following diff was offered to address this issue however the hard coded values are not supported by all X11 servers.
--- qt4-x11-4.5.1/src/gui/kernel/qkeymapper_x11.original.cpp 2009-04-21 23:57:41.000000000 +0000 +++ qt4-x11-4.5.1/src/gui/kernel/qkeymapper_x11.cpp 2009-05-12 00:27:28.000000000 +0000 @@ -283,6 +283,8 @@ } enum { MaxBits = sizeof(uint) * 8 }; +enum { AlternativeKeymapMask1 = 1 << 13 }; +enum { AlternativeKeymapMask2 = 1 << 14 }; static QString translateKeySym(KeySym keysym, uint xmodifiers, int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count); @@ -297,8 +299,9 @@ // always use them when determining the baseKeySym) KeySym baseKeySym; 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)) return QList<int>(); QList<int> result; @@ -337,6 +340,13 @@ val |= (1 << pos1Bits[j]); } + if (xmodifiers & AlternativeKeymapMask1) { + val |= AlternativeKeymapMask1; + } + if (xmodifiers & AlternativeKeymapMask2) { + val |= AlternativeKeymapMask2; + } + if ((xmodifiers