// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Reactive.Subjects;
using Avalonia.Input.Raw;
namespace Avalonia.Input
{
///
/// Recieves input from the windowing subsystem and dispatches it to interested parties
/// for processing.
///
public class InputManager : IInputManager
{
private readonly Subject _preProcess = new Subject();
private readonly Subject _process = new Subject();
private readonly Subject _postProcess = new Subject();
///
/// Gets the global instance of the input manager.
///
public static IInputManager Instance => AvaloniaLocator.Current.GetService();
///
public IObservable PreProcess => _preProcess;
///
public IObservable Process => _process;
///
public IObservable PostProcess => _postProcess;
///
public void ProcessInput(RawInputEventArgs e)
{
_preProcess.OnNext(e);
_process.OnNext(e);
_postProcess.OnNext(e);
}
}
}