Browse Source

fix keyboard input

Dan Walmsley 7 years ago
parent
commit
bab421a8e0

+ 7 - 1
src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

@@ -35,6 +35,8 @@ namespace Avalonia.Controls.Remote.Server
         {
             _transport = transport;
             _transport.OnMessage += OnMessage;
+
+            KeyboardDevice = AvaloniaLocator.Current.GetService<IKeyboardDevice>();
         }
 
         private static RawMouseEventType GetAvaloniaEventType (Avalonia.Remote.Protocol.Input.MouseButton button, bool pressed)
@@ -209,6 +211,8 @@ namespace Avalonia.Controls.Remote.Server
                 }
                 if(obj is KeyEventMessage key)
                 {
+                    Dispatcher.UIThread.RunJobs(DispatcherPriority.Input + 1);
+
                     Dispatcher.UIThread.Post(() =>
                     {
                         Input?.Invoke(new RawKeyEventArgs(
@@ -221,6 +225,8 @@ namespace Avalonia.Controls.Remote.Server
                 }
                 if(obj is TextInputEventMessage text)
                 {
+                    Dispatcher.UIThread.RunJobs(DispatcherPriority.Input + 1);
+
                     Dispatcher.UIThread.Post(() =>
                     {
                         Input?.Invoke(new RawTextInputEventArgs(
@@ -323,6 +329,6 @@ namespace Avalonia.Controls.Remote.Server
 
         public override IMouseDevice MouseDevice { get; } = new MouseDevice();
 
-        public IKeyboardDevice KeyboardDevice { get; } = new KeyboardDevice();
+        public IKeyboardDevice KeyboardDevice { get; }
     }
 }

+ 2 - 1
src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs

@@ -57,7 +57,8 @@ namespace Avalonia.DesignerSupport.Remote
                 .Bind<IRenderTimer>().ToConstant(threading)
                 .Bind<ISystemDialogImpl>().ToSingleton<SystemDialogsStub>()
                 .Bind<IWindowingPlatform>().ToConstant(instance)
-                .Bind<IPlatformIconLoader>().ToSingleton<IconLoaderStub>();
+                .Bind<IPlatformIconLoader>().ToSingleton<IconLoaderStub>()
+                .Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>();
 
         }