I just built the JUceDemo with latest develop code. Started up demo app, went to keyboard shortcuts and tried to map a new shortcut. Alt+Anykey works if using left Alt key, but doesn’t if using right all.
Which keyboard layout are you using? Layouts like AZERTY map the right Alt key to AltGr instead so users can type accented letters. I think this will appear to applications as Ctrl+Alt.
I’m using US Querty
You are not in a VM right? For some reason, some VMs have problems with this.
Not in a VM, a user reported it and I can reproduce in the JuceDemo. I’ll dig into it.
This has been brought up before: ALT modifier bug in Windows
The problem is [juce_win32_Windowing.cpp
line 976] (https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/native/juce_win32_Windowing.cpp#L976), if you comment that line out then right-Alt will work. But note that some keyboard layouts map that key to AltGr
instead, which will be reported to applications as Ctrl + Alt
.
The opposite is also true, if your keyboard layout allows you to type accented letters with AltGr
then you can type the same letters with Ctrl+Alt
, for instance on my layout both AltGr + A
and Ctrl + Alt + A
will produce an accented letter “á”.
OK. I’ve changed the way JUCE handles this on develop - don’t blame me if everything blows up now ;-).
Tried it over here, nothing blew up .
On second look, this breaks the right-Ctrl + right-Alt combo on a standard US Querty layout. It’s not possible to make all cases work as expected, but you can make the test more precise by checking if right-Alt is down, but not right-Control:
// workaround: Windows maps AltGr to left-Ctrl + right-Alt.
if (isKeyDown (VK_RMENU) && !isKeyDown (VK_RCONTROL))
{
keyMods = (keyMods & ~ModifierKeys::ctrlModifier) | ModifierKeys::altModifier;
}
I knew it! OK, I’ve added it to develop.