Right Alt doesn't work on Windows 10


#1

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.


#2

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.


#3

I’m using US Querty


#4

You are not in a VM right? For some reason, some VMs have problems with this.


#5

Not in a VM, a user reported it and I can reproduce in the JuceDemo. I’ll dig into it.


#6

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 “á”.


#7

OK. I’ve changed the way JUCE handles this on develop - don’t blame me if everything blows up now ;-).


#8

Tried it over here, nothing blew up :slight_smile:.


#9

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;
        }

#10

I knew it! :slight_smile: OK, I’ve added it to develop.