Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AltGr button does not work correctly on QWERTZ keyboard #98854

Closed
gitsomebit opened this issue Nov 5, 2024 · 3 comments · Fixed by #98887
Closed

AltGr button does not work correctly on QWERTZ keyboard #98854

gitsomebit opened this issue Nov 5, 2024 · 3 comments · Fixed by #98887
Assignees
Milestone

Comments

@gitsomebit
Copy link

Tested versions

  • Reproducable in 4.3 stable and 4.2 stable

System information

Windows 10 - Godot 4.3 - Compatibility - QWERTZ keyboard

Issue description

I am working on a input remapping system for my game.
As you know when AltGr is pressed together with another key, the key should have the modifiers of Ctrl and Alt.
This is not the case for all keys as it works for some and for some it does not.

Steps to reproduce

create a new scene with a control node and use the _input() function:

func _input(event: InputEvent) -> void:
	if event is InputEventKey and event.pressed and not event.is_echo():
		match event.physical_keycode:
			KEY_CTRL, KEY_SHIFT:
				pass
			_:
				print(event)

When holding down AltGr and pressing the toprow number keys one after another produces the following results (some have mods, some dont):

InputEventKey: keycode=4194328 (Alt), mods=Ctrl, physical=false, location=right, pressed=true, echo=false
InputEventKey: keycode=49 (1), mods=Ctrl+Alt, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=50 (2), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=51 (3), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=52 (4), mods=Ctrl+Alt, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=53 (5), mods=Ctrl+Alt, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=54 (6), mods=Ctrl+Alt, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=55 (7), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=56 (8), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=57 (9), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=48 (0), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=91 (BracketLeft), mods=none, physical=false, location=unspecified, pressed=true, echo=false
InputEventKey: keycode=93 (BracketRight), mods=Ctrl+Alt, physical=false, location=unspecified, pressed=true, echo=false

Minimal reproduction project (MRP)

MRP_Godot-4.3: AltGr_Bug.zip

@gitsomebit
Copy link
Author

QWERTZ keyboard layout:image

@bruvzg
Copy link
Member

bruvzg commented Nov 5, 2024

As you know when AltGr is pressed together with another key, the key should have the modifiers of Ctrl and Alt.

Ctrl+Alt can be used as substitute for AltGr (on Windows), not sure if reverse should be always true.

The keys that do not have modifiers set seems to keys with associated third level character values (blue), so it's likely cause by processing characters:
Screenshot 2024-11-05 at 19 57 54

@bruvzg
Copy link
Member

bruvzg commented Nov 6, 2024

We actually deliberately unset modifiers for key events like this:

if (k->get_unicode() && ke.altgr) {
k->set_alt_pressed(false);
k->set_ctrl_pressed(false);
}

It was like added in #189, before proper IME support, and might unnecessary (or at least can be only enabled while text input mode is active).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants