Browse Source

fix keyboard input

pull/1976/head
Dan Walmsley 8 years ago
parent
commit
bab421a8e0
  1. 8
      src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs
  2. 3
      src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs

8
src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

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

3
src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs

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

Loading…
Cancel
Save