From 442e97152d23f5c017a14b4db9642bd27ce46ca2 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 30 May 2013 14:48:20 +0000 Subject: [PATCH] Simplify the lookup of alternative keysyms. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5118 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/Input.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc index 5f96f380..83f2ef3e 100644 --- a/unix/xserver/hw/vnc/Input.cc +++ b/unix/xserver/hw/vnc/Input.cc @@ -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; } } -- 2.39.5