From 88e0c720579f2350f4248302d246eb67df125942 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 15 Jun 2010 07:33:38 +0000 Subject: [PATCH] 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 --- unix/xserver/hw/vnc/Input.cc | 22 ++++++++++++++-------- 1 file 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; -- 2.39.5