Page MenuHome

ALT and ALT GR are not the same in Spanish Spain keyboard distribution
Confirmed, NormalPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 560 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.13

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: rBf6cb5f54494e
Worked: (optional)

Short description of error
In english keyboard distribution, ALT and ALT GR is the same key, for example, ALT+M to Merge is the same for the ALT GR+M, so much comfortable to use with the left hand, but if I change they Windows key distribution to Spanish (Espanol Espana) ALT GR + M won't work, only works ALT + M, and If I change into Blender preferences the keymap for ALT + M to ALT GR + M, it works, but it shows as CTRL + ALT + M and left ALT + M won't work again only works ALT GR + M.

I'm working with Spanish key combination in windows 10

Exact steps for others to reproduce the error
Using Spanish Spain Windows keyboard distribution, select 2 vertices in edit mode, press ALT GR + M, it won't work, go to Preferences, Keymap, search for ALT M Key-Binding and change Merge under Mesh to ALT GR + M.

It will work, but ALT + M won't work again and in keymap will show as CTRL + ALT + M.

Revisions and Commits

Event Timeline

From what I understand is that you describe a few different things at the same time.

  1. Spanish keyboards have ALT and ALT GR keys, and Blender treats those as different modifier keys.
  2. When a shortcut is bound to use ALT GR, Blender still shows it as using ALT.

IMO this is indeed problematic. Blender should either treat ALT GR and ALT as the same modifier key (in which case 1. is the bug and 2. is fine), or treat those two keys as separate (in which case 1. is fine and 2. is the bug).

Please correct me if I'm not understanding this correctly, and confirm where I'm right. I can't investigate this myself as I don't have a keyboard with ALT GR key.

Ricardo (INeedMana) added a comment.EditedAug 6 2019, 9:30 PM

You are correct in point 1, but not in point 2.

  1. When a shortcut is bound to use ALT GR, Blender shows it as using CTRL + ALT + key:

This image shows what happens if I change ALT+M to ALT GR + M:

Of course, in any moment I press CTRL key when binding ALT GR + M.

Either way, after showing as CTRL + ALT keys, I can use both ALT GR + M, or CTRL + ALT + M, both works.

On Windows Ctrl+Alt and AltGr are equivalents,
and it is recommended that this combination not be used as a modifier.

So strictly speaking, there's no bug.

https://en.wikipedia.org/wiki/AltGr_key#Control_+_Alt_as_a_substitute
https://devblogs.microsoft.com/oldnewthing/20040329-00/?p=40003
https://github.com/Microsoft/vscode/issues/50341

continuing T68485

Windows7 machine:

wm_event_do_handlers: Handling event
wmEvent  type:214 / RIGHT_ALT, val:1 / PRESS,
         shift:0, ctrl:0, alt:1, oskey:0, keymodifier:0,
         mouse:(367,886), ascii:' ', utf8:'', keymap_idname:(null), pointer:000000000EA0F538

wm_event_do_handlers: Handling event
wmEvent  type:214 / RIGHT_ALT, val:2 / RELEASE,
         shift:0, ctrl:0, alt:0, oskey:0, keymodifier:0,
         mouse:(367,886), ascii:' ', utf8:'', keymap_idname:(null), pointer:000000000EA0F538

Windows10 machine:

wm_event_do_handlers: Handling event
wmEvent  type:215 / RIGHT_CTRL, val:1 / PRESS,
         shift:0, ctrl:1, alt:0, oskey:0, keymodifier:0,
         mouse:(296,1231), ascii:' ', utf8:'', keymap_idname:(null), pointer:00000173F70B0768

wm_event_do_handlers: Handling event
wmEvent  type:214 / RIGHT_ALT, val:1 / PRESS,
         shift:0, ctrl:1, alt:3, oskey:0, keymodifier:0,
         mouse:(296,1231), ascii:' ', utf8:'', keymap_idname:(null), pointer:00000173F70AF8C8

wm_event_do_handlers: Handling event
wmEvent  type:215 / RIGHT_CTRL, val:2 / RELEASE,
         shift:0, ctrl:0, alt:3, oskey:0, keymodifier:0,
         mouse:(296,1231), ascii:' ', utf8:'', keymap_idname:(null), pointer:00000173F70B0768

wm_event_do_handlers: Handling event
wmEvent  type:214 / RIGHT_ALT, val:2 / RELEASE,
         shift:0, ctrl:0, alt:0, oskey:0, keymodifier:0,
         mouse:(296,1231), ascii:' ', utf8:'', keymap_idname:(null), pointer:00000173F70AF8C8

In both system i'm using same layout that utilities AltGr as modifier to type "ęąó" and so on
Blender does recognize AltGr, but aparently not in all cases. So its half working feature. Imo this is a bug.

https://developer.blender.org/rBACc52e7c13706e96816f5f8893349d602803948ae2
There was fix for that, but for some reason it is not working for us.

There is "The keyboard driver in Windows sends left control events when AltGr is pressed."
And i guess win10 driver is sending right control instead of left one, and that fix dont work in this case.

This is an issue for me too. Recently switched to a Windows 10 machine from MacOS. I have Windows 10 Pro CJK installed but trying to run it in English, I've uninstalled the Japanese language and keyboard (but Windows being as crap as it is, still has some screens in Japanese).

In Blender the right Alt key on my keyboard (US) is registering as Alt Gr (which I have a feeling that it shouldn't but this is Windows). Windows will not let me remap the Alt Gr key in the registry. It constantly overrides SharpKeys and editing the registry directly.

As a left handed person, this is an accessibility issue for Blender because the right Alt is one of the most used keys for orthographic viewport tumble locking. It's probably the most used key in Blender for me.

If there was just a setting in Preferences>Keymap for "Use Alt Gr as right Alt" and handle that through the whole Blender interface that would be a big help. If there was a way that Blender was smart enough to switch it off when typing in text fields that would be a total fix but in the meantime an "Alt Gr as Alt" option would be super helpful.

Same in french keyboard Atl ant Alt Gr are différent. Atl gr worked very well in 2.79 and not in 2.80 we are forced to use alt M which makes a big difference from the hand. We can't put Alt gr in the keys preference because blender recognizes it as the ctrl key

Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Jan 7 2020, 2:40 PM

I can confirm this behavior.

I will say, I have seen no application, that treats AltGr as Alt on windows.

On similar note, using AltGr or Ctrl + Alt to input special characters is broken, but that should be new report probably.

Bastien Montagne (mont29) changed the subtype of this task from "Report" to "Bug".Jan 15 2020, 8:44 PM

Just to say that this problem is also reproducible in Linux OS.

Here using Kubuntu Linux 20.04. If I choose English Layout then "Alt" and "Alt Gr" work the same. For example "Alt" works just like "Alt Gr" for Loop Select. If I choose Spanish Layout then "Alt Gr" does not work.

@Aaron Carlisle (Blendify) , @Bastien Montagne (mont29) Do you think I should open a new report or you can update this report for Linux platform too?

Just adding some background to this because there are a lot of things in this thread that is incorrect.

First, there is no separate keycode for Alt-Gr versus Right Alt. And there isn't any physical difference in those keys that are sometimes painted with the word "Alt" and sometimes "Alt-Gr". This is really just a behavior difference in the OS keyboard layout.

Having Alt-Gr in a keyboard layout is a way of getting alternative graphics for some locations that need occasional access to characters not regularly used and not otherwise visible on the keycaps.

Lets start with a perfectly ordinary system. So Windows set to "English (United States)" with a keyboard layout of "US Keyboard". When I press the right Alt key I just get the keycode for right alt. If I depress the right Alt and press the "C" key I get the correct keycodes for Alt-C that Blender can interpret this as an Alt-C and run some operator if you have one associated.

But with this same computer I can add a new language. This time I choose the same language but select "United States International Keyboard", which is one that does Alt-Gr. And if you could buy such a thing then the right alt key would have an "Alt-Gr" stencil on it. But mine doesn't, but that makes no difference because the keyboards are the same.

Now when I press the right-alt key the keyboard layout makes it emit both the keycode for right-alt down but also for ctrl down. This is simply how this works. Alt-Gr == Right Alt + Ctrl. Blender will no longer trigger an operator unless it knows that it should expect both Alt and Ctrl at the same time. Using Alt+Ctrl in this way is hidden from the user and is just an under-the-hood detail. It is the magic that allows me to press my right-alt and 5 to get €.

So if you have a keyboard layout that does Alt-Gr then you just have to know that your right alt is not producing ALT but ALT + CTRL, while your left Alt continues to product just Alt.

YAFU (YAFU) added a comment.EditedFri, Jan 14, 9:15 PM

@Harley Acheson (harley) , I'm not sure I understood :) Anyway thanks for the clarification. At least on my Linux OS "Alt Gr" and "Right Alt + Ctrl" are not doing the same things.

But really the question is that "Alt" key works the same as "Alt Gr" key is something frequently desired by users in forums or in this report for example (left hand users for example).
Would it be possible to do from the Blender preferences that "Alt Gr" key behaves like "Alt" key?. I know that this is becoming more a request than anything else, but to know if on the side of Blender, something could be done.

@YAFU (YAFU) - I'm not sure I understood :)...

It is definitely weird and hard to explain. Best to imagine it as Microsoft wanting to allow access to some keys, like accented characters, copyright, etc easier without being able to add any new keys to the keyboard. So they added an optional mode to keyboard layouts. With this mode turned OFF then both Alts are treated as normal. But with this mode ON the left Alt behaves as normally while the right one gives out both Alt and Ctrl and that combination can result in Alt-Gr+C giving you a ©.

At least on my Linux OS "Alt Gr" and "Right Alt + Ctrl" are not doing the same things.

Your keyboard should only have one key to the right of space bar that is either marked as "Alt" or "Alt-Gr", and that key will either produce just a keycode for right alt or it will product both alt and ctrl if treated as Alt-Gr.

Generally people don't know how this is all hooked up under the hood, and rarely know the name of their keyboard layout. It is usually set to something during setup based on their region or they might change it by accident.

When the layout is changed by accident you can get weird IT reports. With US International layout pressing double quote then some keys gives you accented key. So " + e gives you ë, which can be totally unexpected. Single quote + a gives me á. And this layout also treats that right alt as Alt-Gr so pressing that + C gives me ©. And pressing left-alt + ctrl + C also gives me ©, which is by design.

But really the question is that "Alt" key works the same as "Alt Gr" key is something frequently desired by users in forums or in this report for example (left hand users for example).
Would it be possible to do from the Blender preferences that "Alt Gr" key behaves like "Alt" key?. I know that this is becoming more a request than anything else, but to know if on the side of Blender, something could be done.

The problem is really that we have no way of testing for this. Without changing anything in Blender or any hardware, I can make a simple change in my OS that results in that key either giving just right-alt or giving right-alt plus ctrl. Blender has no idea, it just gets different keypresses.

About the only thing I can think of is to always treat right-alt + ctrl as a right-alt only. But this discarding of ctrl in this way would have to be done for everyone and therefore cuts down the number of key combinations that users can map.

I can look into it, but although we now get lots of "why does my alt key not work properly?" reports, I think we'd also get lots of "why can I no longer map an operator to "ctrl-alt-c".

Yeap, is Microsoft "bug". But some apps can figure out that only AltGr without Ctrl is pressed. But its not common and even big apps don't deal with it.

I found out temporary workaround. In windows10 You can set up keyboard layout per application, so you can use standard "United States" keyboard layout in Blender and your regular layout everywhere else.
but unfortunately windows dont store saves those changes so You have to change it every time You run Blender.
Example:

Your keyboard should only have one key to the right of space bar that is either marked as "Alt" or "Alt-Gr", and that key will either produce just a keycode for right alt or it will product both alt and ctrl if treated as Alt-Gr.

This is basically my Spanish Keyboard Layout (It is a Layout sold for Latin America (Spanish/Portuguese):
http://kbdlayout.info/kbdsp

Using "xev -even keyboard" on Linux while Spanish layout is selected:
With "Alt" I get: state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES

With "Alt Gr" I get: state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES

I can look into it, but although we now get lots of "why does my alt key not work properly?" reports, I think we'd also get lots of "why can I no longer map an operator to "ctrl-alt-c".

It is possible that what you say will happen. In that cases it would be nice to have an option from user preferences "treat Alt and Alt Gr keys as the same thing", or something like that. To satisfy as many possible users.

@YAFU (YAFU) - This is basically my Spanish Keyboard Layout (It is a Layout sold for Latin America (Spanish/Portuguese)...

If you compile I would love for you to test the following patch: D13876: Fix T68256: Treat AltGr as Alt in Keymaps

YAFU (YAFU) added a comment.EditedThu, Jan 20, 12:58 AM

@Harley Acheson (harley) , Hi

I have built Blender Master with the patch and unfortunately it does not work on my Kubuntu Linux OS (KDE). "Alt Gr" Key does not work like "Alt" key if Spanish keyboard distribution is selected in my OS. Is there any information that I could share with you and that could be useful? Is there any way for debug key entries and know how are they detected in Blender?

Anyway, it would be good for some Blender developer with experience in Linux and input devices and with no English keyboards distributions experience can give some feedback about this. Maybe @Bastien Montagne (mont29) ? (Sorry Bastien If I bothered you when quote you here)

@YAFU (YAFU) - unfortunately it does not work on my Kubuntu Linux OS (KDE).

This patch would only affect Windows, as indicated by this bug report. However, the patch is written so that it should be relatively easy to implement by other platforms. At its core is a Ghost function that returns whether the current keyboard layout includes AltGr. The Windows version of this function works properly, while the versions for other platforms simply return false.

YAFU (YAFU) added a comment.EditedThu, Jan 20, 2:07 AM

@YAFU (YAFU) - unfortunately it does not work on my Kubuntu Linux OS (KDE).

This patch would only affect Windows, as indicated by this bug report

Sorry, I can not try it in Windows OS.