XkbTranslateKeyCode() is not implemented according to
specification in any system I can find, so change our code
to follow reality rather than specification.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5106 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/xserver/hw/vnc/InputXKB.cc b/unix/xserver/hw/vnc/InputXKB.cc
index f3211bf..04e377c 100644
--- a/unix/xserver/hw/vnc/InputXKB.cc
+++ b/unix/xserver/hw/vnc/InputXKB.cc
@@ -414,7 +414,14 @@
 		if (ks == NoSymbol)
 			continue;
 
-		if (state_out & state & LockMask)
+		/*
+		 * Despite every known piece of documentation on
+		 * XkbTranslateKeyCode() stating that mods_rtrn returns
+		 * the unconsumed modifiers, in reality it always
+		 * returns the _potentially consumed_ modifiers.
+		 */
+		state_out = state & ~state_out;
+		if (state_out & LockMask)
 			XkbConvertCase(ks, &dummy, &ks);
 
 		if (ks == keysym)