Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property `InputEventKey.location`, which indicates the left/right location of key events which may come from one of two physical keys, eg. Shift, Ctrl. It also adds simulation of missing Shift KEYUP events for Windows. When multiple Shifts are held down at the same time, Windows natively only sends a KEYUP for the last one to be released.
This commit is contained in:
parent
4b6ad34988
commit
8406e60522
35 changed files with 397 additions and 26 deletions
|
|
@ -187,6 +187,7 @@ void DisplayServerWeb::_key_callback(const String &p_key_event_code, const Strin
|
|||
|
||||
Key keycode = dom_code2godot_scancode(p_key_event_code.utf8().get_data(), p_key_event_key.utf8().get_data(), false);
|
||||
Key scancode = dom_code2godot_scancode(p_key_event_code.utf8().get_data(), p_key_event_key.utf8().get_data(), true);
|
||||
KeyLocation location = dom_code2godot_key_location(p_key_event_code.utf8().get_data());
|
||||
|
||||
DisplayServerWeb::KeyEvent ke;
|
||||
|
||||
|
|
@ -197,6 +198,7 @@ void DisplayServerWeb::_key_callback(const String &p_key_event_code, const Strin
|
|||
ke.physical_keycode = scancode;
|
||||
ke.key_label = fix_key_label(c, keycode);
|
||||
ke.unicode = fix_unicode(c);
|
||||
ke.location = location;
|
||||
ke.mod = p_modifiers;
|
||||
|
||||
if (ds->key_event_pos >= ds->key_event_buffer.size()) {
|
||||
|
|
@ -1383,6 +1385,7 @@ void DisplayServerWeb::process_events() {
|
|||
ev->set_physical_keycode(ke.physical_keycode);
|
||||
ev->set_key_label(ke.key_label);
|
||||
ev->set_unicode(ke.unicode);
|
||||
ev->set_location(ke.location);
|
||||
if (ke.raw) {
|
||||
dom2godot_mod(ev, ke.mod, ke.keycode);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue