@ -1621,6 +1621,21 @@ static Visual *find_truecolor_visual( Display *dpy, int scr, int *depth, int *nc
return v ;
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
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 ( maskIndex = 0 ; maskIndex < 8 ; maskIndex + + ) {
for ( i = 0 ; i < map - > max_keypermod ; i + + ) {
for ( i = 0 ; i < map - > max_keypermod ; i + + ) {
if ( map - > modifiermap [ mapIndex ] ) {
if ( map - > modifiermap [ mapIndex ] ) {
KeySym sym =
KeySym sym = qt_x11_keycode_to_keysym ( appDpy , map - > modifiermap [ mapIndex ] ) ;
XkbKeycodeToKeysym ( appDpy , map - > modifiermap [ mapIndex ] , 0 , 0 ) ;
if ( qt_alt_mask = = 0 & &
if ( qt_alt_mask = = 0 & &
( sym = = XK_Alt_L | | sym = = XK_Alt_R ) ) {
( sym = = XK_Alt_L | | sym = = XK_Alt_R ) ) {
qt_alt_mask = 1 < < maskIndex ;
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 + + ) {
for ( i = 0 ; i < map - > max_keypermod ; i + + ) {
if ( map - > modifiermap [ mapIndex ] ) {
if ( map - > modifiermap [ mapIndex ] ) {
KeySym sym =
KeySym sym = qt_x11_keycode_to_keysym ( appDpy , map - > modifiermap [ mapIndex ] ) ;
XkbKeycodeToKeysym ( appDpy , map - > modifiermap [ mapIndex ] , 0 , 0 ) ;
if ( sym = = XK_Mode_switch ) {
if ( sym = = XK_Mode_switch ) {
qt_mode_switch_remove_mask | = 1 < < maskIndex ;
qt_mode_switch_remove_mask | = 1 < < maskIndex ;
}
}