diff --git a/OpenRA.FileFormats/Graphics/IInputHandler.cs b/OpenRA.FileFormats/Graphics/IInputHandler.cs index 29d7c56291..397ebb1c35 100755 --- a/OpenRA.FileFormats/Graphics/IInputHandler.cs +++ b/OpenRA.FileFormats/Graphics/IInputHandler.cs @@ -70,5 +70,6 @@ namespace OpenRA public string KeyName; public Modifiers Modifiers; public int VirtKey; + public int MultiTapCount; } } diff --git a/OpenRA.Renderer.SdlCommon/MultiTapDetection.cs b/OpenRA.Renderer.SdlCommon/MultiTapDetection.cs index 5a483a96cf..9e1c013393 100644 --- a/OpenRA.Renderer.SdlCommon/MultiTapDetection.cs +++ b/OpenRA.Renderer.SdlCommon/MultiTapDetection.cs @@ -26,13 +26,10 @@ public static class MultiTapDetection return clickHistory.GetTapCount(xy); } - static readonly string[] KeyNameModifiers = new [] { "", "", "DoubleTapOf_", "TripleTapOf_" }; - - public static string DetectFromKeyboard(string KeyName) + public static int DetectFromKeyboard(string KeyName) { var keyHistory = KeyHistoryCache[KeyName]; - var count = keyHistory.GetTapCount(int2.Zero); - return KeyNameModifiers[count]; + return keyHistory.GetTapCount(int2.Zero); } } diff --git a/OpenRA.Renderer.SdlCommon/SdlInput.cs b/OpenRA.Renderer.SdlCommon/SdlInput.cs index 797f2d7cf9..8652c93e77 100644 --- a/OpenRA.Renderer.SdlCommon/SdlInput.cs +++ b/OpenRA.Renderer.SdlCommon/SdlInput.cs @@ -116,14 +116,16 @@ namespace OpenRA.Renderer.SdlCommon case Sdl.SDL_KEYUP: { + var keyName = Sdl.SDL_GetKeyName( e.key.keysym.sym ); + var keyEvent = new KeyInput { Event = KeyInputEvent.Up, Modifiers = mods, UnicodeChar = (char)e.key.keysym.unicode, -// KeyName = MultiTapDetection.DetectFromKeyboard(Sdl.SDL_GetKeyName( e.key.keysym.sym )), KeyName = Sdl.SDL_GetKeyName( e.key.keysym.sym ), - VirtKey = e.key.keysym.sym + VirtKey = e.key.keysym.sym, + MultiTapCount = MultiTapDetection.DetectFromKeyboard(keyName) }; inputHandler.OnKeyInput( keyEvent );