diff options
Diffstat (limited to 'src/kernel/qapplication_x11.cpp')
-rw-r--r-- | src/kernel/qapplication_x11.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index 2cda2b8b3..f5f2701ad 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -1621,6 +1621,21 @@ static Visual *find_truecolor_visual( Display *dpy, int scr, int *depth, int *nc return v; } +static KeySym qt_x11_keycode_to_keysym(Display *dpy, KeyCode kc) { +#ifndef TQT_NO_XKB + return XkbKeycodeToKeysym(dpy, kc, 0, 0); +#else + KeySym rv = NoSymbol; + int keysyms_per_keycode; + KeySym *keysym_p = XGetKeyboardMapping(dpy, kc, 1, &keysyms_per_keycode); + if (keysyms_per_keycode>0) { //< Should always be true unless X server is bugged + rv = keysym_p[0]; + } + XFree(keysym_p); + + return rv; +#endif // TQT_NO_XKB +} /***************************************************************************** tqt_init() - initializes TQt for X11 @@ -2151,8 +2166,7 @@ void tqt_init_internal( int *argcptr, char **argv, for (maskIndex = 0; maskIndex < 8; maskIndex++) { for (i = 0; i < map->max_keypermod; i++) { if (map->modifiermap[mapIndex]) { - KeySym sym = - XkbKeycodeToKeysym(appDpy, map->modifiermap[mapIndex], 0, 0); + KeySym sym = qt_x11_keycode_to_keysym(appDpy, map->modifiermap[ mapIndex ]); if ( qt_alt_mask == 0 && ( sym == XK_Alt_L || sym == XK_Alt_R ) ) { qt_alt_mask = 1 << maskIndex; @@ -2181,8 +2195,7 @@ void tqt_init_internal( int *argcptr, char **argv, for ( i = 0; i < map->max_keypermod; i++ ) { if ( map->modifiermap[ mapIndex ] ) { - KeySym sym = - XkbKeycodeToKeysym( appDpy, map->modifiermap[ mapIndex ], 0, 0 ); + KeySym sym = qt_x11_keycode_to_keysym(appDpy, map->modifiermap[ mapIndex ]); if ( sym == XK_Mode_switch ) { qt_mode_switch_remove_mask |= 1 << maskIndex; } |