Situation: Accessing Windows 2000 with a German Keyboard driver running
winVNC 3.3.3 R9 from Debian GNU/Linux with TightVNC viewer version 1.2.2
(based on VNC 3.3.3r2) also with a German keyboard.
This setup has problems with input of characters that require the AltGr
key (i.e. @\{}[]~|).
In a CMD window, entering these characters works but they're prefixed
with a tilde (~). One solution for this part is to simply not send the
Mode_switch key strokes which can be achieved by overriding the
baseTranslations like this (the important part here is that the
Mode_switch key events are mapped to nothing):
Vncviewer*desktop.baseTranslations: #override\n\
<Key>F8: ShowPopup()\n\
<KeyPress>Mode_switch: \n\
<KeyRelease>Mode_switch: \n\
<ButtonPress>: SendRFBEvent()\n\
<ButtonRelease>: SendRFBEvent()\n\
<Motion>: SendRFBEvent()\n\
<KeyPress>: SendRFBEvent()\n\
<KeyRelease>: SendRFBEvent()
Even with this fix, GNU Emacs (at least versions 20 and 21) and the
cygwin terminal window still have problems with the AltGr characters. It
turns out that Emacs is very picky when determining in which cases to
call TranslateMessage (only TranslateMessage will convert the key events
for the AltGr keys to a WM_CHAR event with the right character).
Unfortunately the event sequence generated by WinVNC is a bit different
from what Emacs expects and what Windows 2000 itself generates.
AltGr is "simulated" by NT by pretending that both the left control key
and the right alt key have been pressed. The event for the right alt-key
is VK_MENU with the "extended" bit set.
The bug in winVNC is that it doesn't set the KEYEVENTF_EXTENDEDKEY flag
when it generates the event. The patch below fixes this for me with both
Emacs and cygwin. I only tested this on our Windows 2000 Professional
system. The patch doesn't touch the Win95 specific code as I don't know
whether that has the same problem.
I hope it's OK to send patches to this list. There doesn't seem to be a
separate developer list or even a developer email address.
Bernhard
Here's the patch:
--- vncKeymap.cpp.~1~ Mon Mar 19 15:58:24 2001
+++ vncKeymap.cpp Sat Aug 10 19:53:58 2002
@@ -153,7 +153,7 @@
}
void
-SetShiftState(BYTE key, BOOL down)
+SetShiftState(BYTE key, BOOL down, BOOL extended = 0)
{
BOOL keystate = (GetAsyncKeyState(key) & 0x8000) != 0;
@@ -167,7 +167,8 @@
down ? "down" : "up");
// Now send a key event to set the key to the new value
- KeybdEvent(key, down ? 0 : KEYEVENTF_KEYUP);
+ KeybdEvent(key, ((down ? 0 : KEYEVENTF_KEYUP)
+ | (extended ? KEYEVENTF_EXTENDEDKEY : 0)));
keystate = (GetAsyncKeyState(key) & 0x8000) != 0;
log.Print(LL_INTINFO,
@@ -274,8 +275,9 @@
// But only toggle Ctrl & Alt if they aught to be down
ctrl = (GetAsyncKeyState(VK_LCONTROL) & 0x8000) != 0;
if (!ctrl) SetShiftState(VK_LCONTROL, keymask & 2);
- alt = (GetAsyncKeyState(VK_LMENU) & 0x8000) != 0;
- if (!alt) SetShiftState(VK_LMENU, keymask & 4);
+ alt = (GetAsyncKeyState(VK_RMENU) & 0x8000) != 0;
+ if (!alt) SetShiftState(VK_RMENU, keymask & 4,
+ (keymask & 6) == 6);
}
else
@@ -305,7 +307,7 @@
SetShiftState(VK_LSHIFT, lshift);
SetShiftState(VK_RSHIFT, rshift);
SetShiftState(VK_LCONTROL, ctrl);
- SetShiftState(VK_LMENU, alt);
+ SetShiftState(VK_RMENU, alt, (keymask & 6) == 6);
}
else
{
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://www.mapit.de/
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
http://www.realvnc.com/mailman/listinfo/vnc-list