To support keymaps with only upper (or lower) case keysyms we now

use Xlib to convert an unmatched keysym to upper and lower case and
use whichever, if any, is not the same as the original keysym.
This supports case conversion in any language that Xlib supports
it in.
This commit is contained in:
crs 2003-01-29 22:16:40 +00:00
parent dedb48d244
commit 116005d64f
1 changed files with 9 additions and 9 deletions

View File

@ -28,7 +28,6 @@
# include <X11/Xutil.h> # include <X11/Xutil.h>
# define XK_MISCELLANY # define XK_MISCELLANY
# define XK_XKB_KEYS # define XK_XKB_KEYS
# define XK_LATIN1
# include <X11/keysymdef.h> # include <X11/keysymdef.h>
# if defined(HAVE_X11_EXTENSIONS_XTEST_H) # if defined(HAVE_X11_EXTENSIONS_XTEST_H)
# include <X11/extensions/XTest.h> # include <X11/extensions/XTest.h>
@ -1269,14 +1268,15 @@ CXWindowsSecondaryScreen::findKey(KeyID id, KeyModifierMask& mask) const
// find the keycodes that generate the keysym // find the keycodes that generate the keysym
KeyCodeIndex index = m_keycodeMap.find(keysym); KeyCodeIndex index = m_keycodeMap.find(keysym);
if (index == noKey() && keysym >= XK_a && keysym <= XK_z) { if (index == noKey()) {
// for an unfound lower case alpha, try the equivalent upper // try upper/lower case (as some keymaps only include the
// case (as some keymaps only include the upper case, notably // upper case, notably Sun Solaris).
// Sun Solaris). KeySym lower, upper;
// Note that this depends on the keysyms for 'a' through 'z' XConvertCase(keysym, &lower, &upper);
// and 'A' through 'Z' being contiguous. This is currently if (lower != keysym)
// the case and extremely unlikely to change. index = m_keycodeMap.find(lower);
index = m_keycodeMap.find(keysym + XK_A - XK_a); else if (upper != keysym)
index = m_keycodeMap.find(upper);
} }
if (index == noKey()) { if (index == noKey()) {
// try backup keysym for certain keys (particularly the numpad // try backup keysym for certain keys (particularly the numpad