]> source.dussan.org Git - tigervnc.git/commitdiff
Simplify the lookup of alternative keysyms.
authorPierre Ossman <ossman@cendio.se>
Thu, 30 May 2013 14:48:20 +0000 (14:48 +0000)
committerPierre Ossman <ossman@cendio.se>
Thu, 30 May 2013 14:48:20 +0000 (14:48 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5118 3789f03b-4d11-0410-bbf8-ca57d06f2519

unix/xserver/hw/vnc/Input.cc

index 5f96f3804b72d6ce2c68f94370e4a39ba8ec42de..83f2ef3e1c7652ba1b916a3b7369a260e693da99 100644 (file)
@@ -475,18 +475,18 @@ void InputDevice::keyEvent(rdr::U32 keysym, bool down)
        /* Try some equivalent keysyms if we couldn't find a perfect match */
        if (keycode == 0) {
                for (i = 0;i < sizeof(altKeysym)/sizeof(altKeysym[0]);i++) {
-                       if (altKeysym[i].a == keysym) {
-                               keycode = keysymToKeycode(altKeysym[i].b,
-                                                         state, &new_state);
-                               if (keycode != 0)
-                                       break;
-                       }
-                       if (altKeysym[i].b == keysym) {
-                               keycode = keysymToKeycode(altKeysym[i].a,
-                                                         state, &new_state);
-                               if (keycode != 0)
-                                       break;
-                       }
+                       KeySym altsym;
+
+                       if (altKeysym[i].a == keysym)
+                               altsym = altKeysym[i].b;
+                       else if (altKeysym[i].b == keysym)
+                               altsym = altKeysym[i].a;
+                       else
+                               continue;
+
+                       keycode = keysymToKeycode(altsym, state, &new_state);
+                       if (keycode != 0)
+                               break;
                }
        }