mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes. - Unify IME behaviour, add inline composition string display on Windows and X11. - Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events. - Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS. - Add support for media key handling on macOS. Co-authored-by: Raul Santos <raulsntos@gmail.com>
This commit is contained in:
parent
9937915ad7
commit
daad4aed62
61 changed files with 4464 additions and 3655 deletions
|
|
@ -106,11 +106,11 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
|||
|
||||
// Key is None without a physical key.
|
||||
none_key.set_keycode(Key::NONE);
|
||||
CHECK(none_key.as_text() == " (Physical)");
|
||||
CHECK(none_key.as_text() == "(Unset)");
|
||||
|
||||
// Key is none and has modifiers.
|
||||
none_key.set_ctrl_pressed(true);
|
||||
CHECK(none_key.as_text() == "Ctrl+ (Physical)");
|
||||
CHECK(none_key.as_text() == "Ctrl+(Unset)");
|
||||
|
||||
// Key is None WITH a physical key AND modifiers.
|
||||
none_key.set_physical_keycode(Key::ENTER);
|
||||
|
|
@ -144,8 +144,7 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
|||
TEST_CASE("[InputEventKey] Key correctly converts its state to a string representation") {
|
||||
InputEventKey none_key;
|
||||
|
||||
// Set physical to true.
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=0 (), mods=none, physical=true, pressed=false, echo=false");
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=(Unset), mods=none, physical=false, pressed=false, echo=false");
|
||||
// Set physical key to Escape.
|
||||
none_key.set_physical_keycode(Key::ESCAPE);
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=4194305 (Escape), mods=none, physical=true, pressed=false, echo=false");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue