private void HandleKeyReleaseEvent(object o, KeyReleaseEventArgs args) { var key = (Common.Configuration.Hid.Key)GTK3MappingHelper.ToInputKey(args.Event.Key); if (!(KeyReleasedEvent?.Invoke(key)).GetValueOrDefault(true)) { return; } if (_canProcessInput) { // TODO (caian): This solution may have problems if the pause is sent after a key press // and before a key release. But for now GTK Entry does not seem to use release events. _inputToTextEntry.SendKeyReleaseEvent(o, args); _inputToTextEntry.GetSelectionBounds(out int selectionStart, out int selectionEnd); TextChangedEvent?.Invoke(_inputToTextEntry.Text, selectionStart, selectionEnd, _inputToTextEntry.OverwriteMode); } }
private void AvaloniaDynamicTextInputHandler_KeyRelease(object sender, Avalonia.Input.KeyEventArgs e) { var key = (HidKey)AvaloniaMappingHelper.ToInputKey(e.Key); if (!(KeyReleasedEvent?.Invoke(key)).GetValueOrDefault(true)) { return; } e.RoutedEvent = _hiddenTextBox.GetKeyUpRoutedEvent(); Dispatcher.UIThread.InvokeAsync(() => { if (_canProcessInput) { _hiddenTextBox.SendKeyUpEvent(e); } }); }