SFML community forums
Bindings - other languages => DotNet => Topic started by: omeg on August 08, 2011, 09:40:18 pm
-
Tested on latest source snapshot, built with VS2010. Window.KeyPressed gets incorrect KeyEventArgs when right alt (AltGr) is pressed. Dump from the debugger (unmodified Window sample):
+ e {[KeyEventArgs] Code(LControl) Alt(True) Control(True) Shift(False) System(False)} SFML.Window.KeyEventArgs
You can see that Control flag is set, ant Code is LControl.
Left alt works as expected:
+ e {[KeyEventArgs] Code(LAlt) Alt(True) Control(False) Shift(False) System(False)} SFML.Window.KeyEventArgs
-
Apparently this is the expected behaviour on Windows. It seems that AltGr is just a shortcut for Ctrl + Alt:
Note: the AltGr modifier is regarded as identical to Ctrl+Alt by most Windows keyboards. This is a holdover from the times when many keyboards did not include a right Alt key. Most keyboards today do include the right Alt key, even many laptop keyboards.
The only workaround that I found, is to turn the left-control event into a right-alt one if the right-alt key is down, but this leads to incorrect results if left-control is pressed while right-alt is down. So I'm still searching for a perfect solution.
-
I see. I've inserted a special check in my code for this case and it's working OK so far. It was messing my keyboard input because some special non-ascii language-specific characters are input by combinations of right alt+letter.
-
Are you using KeyPressed events for text input?
-
I was, but I switched to TextEntered. Still, in my KeyPressed handler (used for control characters) I was getting false Ctrl presses from the right alt.