AltGr key still not working in 2.0beta4
Brought to you by:
anton19286,
const_k
Win32 version 2.0beta4 on Windows XP, french keyboard.
Tightvnc connected to a linux guest machine started with Qemu in vnc display mode
The AltGr key is not recognized, in the toolbar above both buttons [Ctrl] [Alt] are seen pressed when the AltGr key is hit and the correct character is not 'reachable'
Try the latest 2.0.2 version. Please let me know if problem is fixed with new version.
I tried with latest 2.0.2 and still the same result.
In particular [Ctrl] [Alt] above is still seen when AltGr is hit...
BTW About TightVNC viewer is still saying "version 1.5.2", apparently it's also in the code (vncviewer/res/vncviewer.rc) ...
Hey guys. I find right alt (altgr) generally working right in 2.7.10, it types Polish national characters. Except one case: when in Outlook, AltGr-s, activates Outlook's shortcut Ctrl-Alt-s, which is not intended. When AltGr-s is pressed directly on the remote station, it types the correct character. In Notepad the situation is normal, the correct character always works through AltGr-s.
I also see Ctrl-Alt being marked in TightVNC when pressing only AltGr. I guess this is the same problem as reported here. Any chances to fix that?
I managed to do some debugging. When tvnviewer receives keyboard events, right alt generates an extra flag (from lParam in WM_KEYDOWN), 0x1000000. This flag indicates AltGr. When server reconstructs the keyboard presses it uses only the Alt key, without differentiating left from right Alt. This happens through altPressNeeded in InputInjector::injectCharEvent (win-system\InputInjector.cpp).
What we need to fix this issue is to simulate 0x1000000 flag in InputInjector. Blunt solution would always use right alt when altPressNeeded. Could it break anything? I believe that all non-ascii characters are always introduced through right alt, not the left on.
Not sure if struggling with right alt directly was leading to a success, I switched to Unicode hacks that were already present in the code. Attaching a diff with comments.
The patch works even in hopeless case. When you assign Ctrl-Alt-S to a Windows shortcut (e.g. Notepad application), you are unable to use AltGr-S even directly on the station. However through patched TightVnc it's possible :)
Please also notice, that when you press AltGr when defining a Windows desktop shortcut - Windows translates it to Ctrl-Alt. So in general translating AltGr into Ctrl-Alt is ok, and that should not be considered a TightVnc bug. Rather Windows "feature".