]> source.dussan.org Git - tigervnc.git/commitdiff
Use a switch statement instead of a series of if:s for setting up the modmap
authorPierre Ossman <ossman@cendio.se>
Tue, 15 Jun 2010 07:33:38 +0000 (07:33 +0000)
committerPierre Ossman <ossman@cendio.se>
Tue, 15 Jun 2010 07:33:38 +0000 (07:33 +0000)
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

index ffe1e47a45d2b94912fecbb3ee9499362f0cbc82..87db443fe56bbd0dd49e1042ec42bed565c6afd9 100644 (file)
@@ -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;