diff --git a/Terminal.Gui/Drivers/V2/ConsoleDriverFacade.cs b/Terminal.Gui/Drivers/V2/ConsoleDriverFacade.cs index 893164d0d..f3091442a 100644 --- a/Terminal.Gui/Drivers/V2/ConsoleDriverFacade.cs +++ b/Terminal.Gui/Drivers/V2/ConsoleDriverFacade.cs @@ -260,16 +260,7 @@ internal class ConsoleDriverFacade : IConsoleDriver, IConsoleDriverFacade /// public virtual string GetVersionInfo () { - var type = ""; - - if (InputProcessor is WindowsInputProcessor) - { - type = "win"; - } - else if (InputProcessor is NetInputProcessor) - { - type = "net"; - } + var type = InputProcessor.DriverName; return "v2" + type; } diff --git a/Terminal.Gui/Drivers/V2/IInputProcessor.cs b/Terminal.Gui/Drivers/V2/IInputProcessor.cs index 2c990db3f..8366788af 100644 --- a/Terminal.Gui/Drivers/V2/IInputProcessor.cs +++ b/Terminal.Gui/Drivers/V2/IInputProcessor.cs @@ -25,6 +25,11 @@ public interface IInputProcessor /// Event fired when a mouse event occurs. event EventHandler? MouseEvent; + /// + /// Gets the name of the driver associated with this input processor. + /// + string DriverName { get; init; } + /// /// Called when a key is pressed down. Fires the event. This is a precursor to /// . diff --git a/Terminal.Gui/Drivers/V2/InputProcessor.cs b/Terminal.Gui/Drivers/V2/InputProcessor.cs index 04a4e3b6c..667d4d267 100644 --- a/Terminal.Gui/Drivers/V2/InputProcessor.cs +++ b/Terminal.Gui/Drivers/V2/InputProcessor.cs @@ -30,6 +30,9 @@ public abstract class InputProcessor : IInputProcessor /// public ConcurrentQueue InputBuffer { get; } + /// + public string DriverName { get; init; } + /// public IAnsiResponseParser GetParser () { return Parser; } diff --git a/Terminal.Gui/Drivers/V2/NetInputProcessor.cs b/Terminal.Gui/Drivers/V2/NetInputProcessor.cs index 36c885e35..f2a2d1aca 100644 --- a/Terminal.Gui/Drivers/V2/NetInputProcessor.cs +++ b/Terminal.Gui/Drivers/V2/NetInputProcessor.cs @@ -20,7 +20,10 @@ public class NetInputProcessor : InputProcessor #pragma warning restore CA2211 /// - public NetInputProcessor (ConcurrentQueue inputBuffer) : base (inputBuffer, new NetKeyConverter ()) { } + public NetInputProcessor (ConcurrentQueue inputBuffer) : base (inputBuffer, new NetKeyConverter ()) + { + DriverName = "net"; + } /// protected override void Process (ConsoleKeyInfo consoleKeyInfo) diff --git a/Terminal.Gui/Drivers/V2/WindowsInputProcessor.cs b/Terminal.Gui/Drivers/V2/WindowsInputProcessor.cs index aa50b20b4..54e8c259c 100644 --- a/Terminal.Gui/Drivers/V2/WindowsInputProcessor.cs +++ b/Terminal.Gui/Drivers/V2/WindowsInputProcessor.cs @@ -13,7 +13,10 @@ internal class WindowsInputProcessor : InputProcessor private readonly bool [] _lastWasPressed = new bool[4]; /// - public WindowsInputProcessor (ConcurrentQueue inputBuffer) : base (inputBuffer, new WindowsKeyConverter ()) { } + public WindowsInputProcessor (ConcurrentQueue inputBuffer) : base (inputBuffer, new WindowsKeyConverter ()) + { + DriverName = "win"; + } /// protected override void Process (InputRecord inputEvent)