German keyboard problems


#1

Hi Jucers

Has anyone of you experienced problems when trying to enter symbols from a german keyboard? I am not able to enter any letters / symbols which need a Keypress from the Alt Gr key first. (This is especially unpleasant when one wants to enter an email address since this needs the combination Alt Gr + Q.

Thx a lot for any tips

Nina


#2

Is this on the mac? If so, are you using the latest files from sourceforge?


#3

No this is on Windows XP


#4

ok, I’ll take a look asap.


#5

Jules, I’ve found where it comes from, but I don’t understand what the code was supposed to do initially:
In juce_win32_windowing.cpp / doKeyChar
the first else code contains:

            if ((currentModifiers & (ModifierKeys::ctrlModifier | ModifierKeys::altModifier)) != 0)
                return false;

which discard AltGr key which can be seen as ctrl+alt.

I’ve solved the issue by changing:

[code]static void updateKeyModifiers() throw()
{
currentModifiers &= ~(ModifierKeys::shiftModifier
| ModifierKeys::ctrlModifier
| ModifierKeys::altModifier);

if ((GetKeyState (VK_SHIFT) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::shiftModifier;

if ((GetKeyState (VK_CONTROL) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::ctrlModifier;

if ((GetKeyState (VK_MENU) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::altModifier;

if ((GetKeyState (VK_RMENU) & 0x8000) != 0)
    currentModifiers &= ~(ModifierKeys::ctrlModifier | ModifierKeys::altModifier);

}
[/code]
In fact, if AltGr is pressed, then the current modifier is modified to ignore the (false)CTRL and ALT key state.
BTW, selecting VK_LMENU for detecting “alt” doesn’t remove the false “ctrl” detection.

Either you keep it that way (but you’ll let the OS deals with the AltGr key by its own), or you add a altGrModifiers in ModifiersKeys and change the code to :

[code]static void updateKeyModifiers() throw()
{
currentModifiers &= ~(ModifierKeys::shiftModifier
| ModifierKeys::ctrlModifier
| ModifierKeys::altModifier
| ModifierKeys::altGrModifier);

if ((GetKeyState (VK_SHIFT) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::shiftModifier;

if ((GetKeyState (VK_CONTROL) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::ctrlModifier;

if ((GetKeyState (VK_MENU) & 0x8000) != 0)
    currentModifiers |= ModifierKeys::altModifier;

if ((GetKeyState (VK_RMENU) & 0x8000) != 0)
    currentModifiers ^= (ModifierKeys::ctrlModifier | ModifierKeys::altModifier | ModifierKeys::altGrModifier);

}
[/code]


#6

Thanks - that’s a good solution. I think I’ll ignore the alt-gr and leave it to the OS like you suggest. There’s not many times you’d care whether it’s down or not.

I’ve checked-in an updated version of this now.


#7

Thank you, works now.

Andreas


#8