diff options
author | Pierre Ossman <ossman@cendio.se> | 2010-06-15 07:33:38 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2010-06-15 07:33:38 +0000 |
commit | 88e0c720579f2350f4248302d246eb67df125942 (patch) | |
tree | 8e5cf28a85a29f5224ab28eba1d87fe6f22e33fc /unix/xserver/hw | |
parent | 6aa2de49cc076d4fd79e2626fc38c8d5a6df40d4 (diff) | |
download | tigervnc-88e0c720579f2350f4248302d246eb67df125942.tar.gz tigervnc-88e0c720579f2350f4248302d246eb67df125942.zip |
Use a switch statement instead of a series of if:s for setting up the modmap
as the readability was quite low.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4065 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/xserver/hw')
-rw-r--r-- | unix/xserver/hw/vnc/Input.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc index ffe1e47a..87db443f 100644 --- a/unix/xserver/hw/vnc/Input.cc +++ b/unix/xserver/hw/vnc/Input.cc @@ -891,17 +891,23 @@ static Bool GetMappings(KeySymsPtr pKeySyms, CARD8 *pModMap) pModMap[i] = NoSymbol; for (i = 0; i < MAP_LEN; i++) { - if (keyboardMap[i * KEYSYMS_PER_KEY] == XK_Caps_Lock) - pModMap[i + MIN_KEY] = LockMask; - else if (keyboardMap[i * KEYSYMS_PER_KEY] == XK_Shift_L || - keyboardMap[i * KEYSYMS_PER_KEY] == XK_Shift_R) + switch (keyboardMap[i * KEYSYMS_PER_KEY]) { + case XK_Shift_L: + case XK_Shift_R: pModMap[i + MIN_KEY] = ShiftMask; - else if (keyboardMap[i * KEYSYMS_PER_KEY] == XK_Control_L || - keyboardMap[i * KEYSYMS_PER_KEY] == XK_Control_R) + break; + case XK_Caps_Lock: + pModMap[i + MIN_KEY] = LockMask; + break; + case XK_Control_L: + case XK_Control_R: pModMap[i + MIN_KEY] = ControlMask; - else if (keyboardMap[i * KEYSYMS_PER_KEY] == XK_Alt_L || - keyboardMap[i * KEYSYMS_PER_KEY] == XK_Alt_R) + break; + case XK_Alt_L: + case XK_Alt_R: pModMap[i + MIN_KEY] = Mod1Mask; + break; + } } pKeySyms->minKeyCode = MIN_KEY; |