Honor modifiers in multitap detection

Fixes Issue #15577.
This commit is contained in:
Clément Bœsch
2019-03-24 18:38:40 +01:00
committed by Oliver Brakmann
parent 54d5afed57
commit 3b926d71b5
2 changed files with 8 additions and 8 deletions

View File

@@ -16,8 +16,8 @@ namespace OpenRA.Platforms.Default
{
static class MultiTapDetection
{
static Cache<Keycode, TapHistory> keyHistoryCache =
new Cache<Keycode, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
static Cache<Pair<Keycode, Modifiers>, TapHistory> keyHistoryCache =
new Cache<Pair<Keycode, Modifiers>, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
static Cache<byte, TapHistory> clickHistoryCache =
new Cache<byte, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
@@ -31,14 +31,14 @@ namespace OpenRA.Platforms.Default
return clickHistoryCache[button].LastTapCount();
}
public static int DetectFromKeyboard(Keycode key)
public static int DetectFromKeyboard(Keycode key, Modifiers mods)
{
return keyHistoryCache[key].GetTapCount(int2.Zero);
return keyHistoryCache[Pair.New(key, mods)].GetTapCount(int2.Zero);
}
public static int InfoFromKeyboard(Keycode key)
public static int InfoFromKeyboard(Keycode key, Modifiers mods)
{
return keyHistoryCache[key].LastTapCount();
return keyHistoryCache[Pair.New(key, mods)].LastTapCount();
}
}