liballeg/allegro5

Broken keyboard input: cannot enter national characters / diacritics (with AltGr modifier)

Closed this issue · 2 comments

Platform: Windows 10

After upgrading Allegro library to the latest version, entering strings with national characters / diacritics (with AltGr modifier) stopped working.

I investigated this situation. The problem probably appeared in Allegro v.5.2.2.

Allegro 5.2.1.1:

pressing AltGr + 'a' produces 'ą' - correct behavior

ev.type = 11 (ALLEGRO_EVENT_KEY_CHAR)
ev.keyboard.keycode = 1 (ALLEGRO_KEY_A)
ev.keyboard.unichar = 261 (Unicode character 'ą' from Latin Extended-A Unicode block)

Allegro 5.2.2+:

pressing AltGr + 'a' produces 'a' - INCORRECT behavior

ev.type = 11 (ALLEGRO_EVENT_KEY_CHAR)
ev.keyboard.keycode = 1 (ALLEGRO_KEY_A)
ev.keyboard.unichar = 97 ('a')

Other examples:

Polish keyboard layout:
AltGr + 'a' produces 'a', should be 'ą'
AltGr + 'l' produces 'l', should be 'ł'
AltGr + 'E' produces 'E', should be 'Ę'

I googled for other countries that use the same way of entering national characters (with AltGr key): Czech Republic and Romania. And entering text in these languages is also broken in Allegro!

Czech keyboard layout:
AltGr + '2' produces '2', should be 'ě'
AltGr + '8' produces '8', should be 'á'

Note to developers to verify and fix this bug: you should use "Polish programmer's keyboard layout". According to Wikipedia (https://en.wikipedia.org/wiki/QWERTY#Polish): "Polish programmer's layout has become the de facto standard, used on virtually all computers sold on the Polish market. Most computer keyboards in Poland are laid out according to the standard US visual and functional layout. Polish diacritics are accessed by using the AltGr key with a corresponding similar letter from the base Latin alphabet."

Similar applies to the other languages mentioned.

Maybe possible duplicate? -> #1430

The problems are probably related. However, I described in more detail the problem with entering diacritics, not just the '@' character.