Right Shift Key Problem

James [Wez] Weatherall jnw "at" orl.co.uk
Fri, 03 Jul 1998 10:35:25 +0000

On Thu, 2 Jul 1998, Dave DeBarr wrote:

> When running WinVNC (v3.3.2) on Windows NT 4.0 with a Solaris 2.6
> vncviewer (v3.3.2), it appears that only the left shift key is being
> processed by the WinVNC server.  The right shift key _appears_ to be
> ignored. 

I'm not sure, but I think this may be an X keymap problem at the viewer
end.  I just tried this out with a keyboard monitor program and both
Solaris and Linux produce the correct Left/Right Shift states at the NT
server end.  The Windows viewer always produces Left Shift, regardless of
whether or not Left or Right Shift was actually pressed.

> The vncKeymap::DoXkeysym() function for WinVNC contains the following
> statements... 
>     if (vncService::IsWinNT())
>     {
>         // ...
>         SetShiftState(VK_LSHIFT, keymask & 1);
>         SetShiftState(VK_RSHIFT, FALSE);
>         // ...
>     }

This code is attempting to set the correct shift state for producing the
desired character.  The keymask just indicates whether or not shift should
be downfor the key to be produced, so the WinVNC server just puts down the
left shift key and leaves the right one up, under NT, since it's unclear
as to what happens if you send VK_LSHIFT down and then try to send
VK_SHIFT down, too.

The idea is that when the client sends the character 'a', the server
corrects the local shift state to ensure that the character 'a' will be
produced, not the character 'A', to avoid problems with non-US keymaps.


James "Wez" Weatherall
Olivetti & Oracle Research Laboratory, Cambridge, UK.
Tel : Work - 343000

The VNC mailing list     -   see http://www.orl.co.uk/vnc/intouch.html