Browse Source

[Mac] Make sure emulated text input is generated after key down (#14407)

* [Mac] Make sure emulated text input is generated after key down

* Don't send AvnKeyEnter as line breaks

* Revert some changes
pull/14430/head
Benedikt Stebner 3 years ago
committed by GitHub
parent
commit
f9c89b1ebb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      native/Avalonia.Native/src/OSX/AvnView.mm

14
native/Avalonia.Native/src/OSX/AvnView.mm

@ -550,6 +550,8 @@
if(hasInputModifier){
if([self handleKeyDown:timestamp withKey:key withPhysicalKey:physicalKey withModifiers:modifiers withKeySymbol:keySymbol]){
//User code has handled the event
_lastKeyDownEvent = nullptr;
return;
}
}
@ -567,10 +569,14 @@
//InputMethod not active
else{
auto keyDownHandled = [self handleKeyDown:timestamp withKey:key withPhysicalKey:physicalKey withModifiers:modifiers withKeySymbol:keySymbol];
//Raise text input event for unhandled key down if there is some key symbol and no input modifier is present
if(!keyDownHandled && modifiers == AvnInputModifiersNone && keySymbol != NULL){
_parent->BaseEvents->RawTextInputEvent(timestamp, [keySymbol UTF8String]);
//Raise text input event for unhandled key down
if(!keyDownHandled){
if(keySymbol != nullptr && key != AvnKeyEnter){
auto timestamp = static_cast<uint64_t>([event timestamp] * 1000);
_parent->BaseEvents->RawTextInputEvent(timestamp, [keySymbol UTF8String]);
}
}
}

Loading…
Cancel
Save