Fix FTBFS with -no-xkb

The analogue of XkbKeycodeToKeysym() used to be XKeycodeToKeysym(), but
it was deprecated in favour of XGetKeyboardMapping() method.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit beb37238fa)
r14.1.x
Alexander Golubev 9 months ago committed by Slávek Banko
parent 77927b79b7
commit 9aa03105ab
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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;
} }

Loading…
Cancel
Save