diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index 5d35c773d7..824f62aee5 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -251,6 +251,9 @@ namespace Avalonia.Native public bool RawTextInputEvent(uint timeStamp, string text) { + if (_inputRoot is null) + return false; + Dispatcher.UIThread.RunJobs(DispatcherPriority.Input + 1); var args = new RawTextInputEventArgs(_keyboard, timeStamp, _inputRoot, text); @@ -262,6 +265,9 @@ namespace Avalonia.Native public bool RawKeyEvent(AvnRawKeyEventType type, uint timeStamp, AvnInputModifiers modifiers, uint key) { + if (_inputRoot is null) + return false; + Dispatcher.UIThread.RunJobs(DispatcherPriority.Input + 1); var args = new RawKeyEventArgs(_keyboard, timeStamp, _inputRoot, (RawKeyEventType)type, (Key)key, (RawInputModifiers)modifiers); @@ -278,6 +284,9 @@ namespace Avalonia.Native public void RawMouseEvent(AvnRawMouseEventType type, uint timeStamp, AvnInputModifiers modifiers, AvnPoint point, AvnVector delta) { + if (_inputRoot is null) + return; + Dispatcher.UIThread.RunJobs(DispatcherPriority.Input + 1); switch (type)