From 40550116f56a5268ecdcdcf38db91d3b553e8811 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 23 May 2013 11:46:35 +0000 Subject: Adding normal alphabetic keysyms as ONE_LEVEL did not behave correctly when CapsLock is active, so start using the ALPHABETIC type for those instead. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5109 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/InputXKB.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/unix/xserver/hw/vnc/InputXKB.cc b/unix/xserver/hw/vnc/InputXKB.cc index a9796e06..7bc23778 100644 --- a/unix/xserver/hw/vnc/InputXKB.cc +++ b/unix/xserver/hw/vnc/InputXKB.cc @@ -485,6 +485,7 @@ KeyCode InputDevice::addKeysym(KeySym keysym, unsigned state) int types[1]; KeySym *syms; + KeySym upper, lower; master = GetMaster(keyboardDev, KEYBOARD_OR_FLOAT); xkb = master->key->xkbInfo->desc; @@ -517,13 +518,28 @@ KeyCode InputDevice::addKeysym(KeySym keysym, unsigned state) changes.names.num_keys = 1; } - /* FIXME: Verify that ONE_LEVEL isn't screwed up */ + /* FIXME: Verify that ONE_LEVEL/ALPHABETIC isn't screwed up */ + + /* + * For keysyms that are affected by Lock, we are better off + * using ALPHABETIC rather than ONE_LEVEL as the latter + * generally cannot produce lower case when Lock is active. + */ + XkbConvertCase(keysym, &lower, &upper); + if (upper == lower) + types[XkbGroup1Index] = XkbOneLevelIndex; + else + types[XkbGroup1Index] = XkbAlphabeticIndex; - types[XkbGroup1Index] = XkbOneLevelIndex; XkbChangeTypesOfKey(xkb, key, 1, XkbGroup1Mask, types, &changes.map); syms = XkbKeySymsPtr(xkb,key); - syms[0] = keysym; + if (upper == lower) + syms[0] = keysym; + else { + syms[0] = lower; + syms[1] = upper; + } changes.map.changed |= XkbKeySymsMask; changes.map.first_key_sym = key; -- cgit v1.2.3