committed by
Oliver Brakmann
parent
54d5afed57
commit
3b926d71b5
@@ -16,8 +16,8 @@ namespace OpenRA.Platforms.Default
|
|||||||
{
|
{
|
||||||
static class MultiTapDetection
|
static class MultiTapDetection
|
||||||
{
|
{
|
||||||
static Cache<Keycode, TapHistory> keyHistoryCache =
|
static Cache<Pair<Keycode, Modifiers>, TapHistory> keyHistoryCache =
|
||||||
new Cache<Keycode, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
|
new Cache<Pair<Keycode, Modifiers>, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
|
||||||
static Cache<byte, TapHistory> clickHistoryCache =
|
static Cache<byte, TapHistory> clickHistoryCache =
|
||||||
new Cache<byte, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
|
new Cache<byte, TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1)));
|
||||||
|
|
||||||
@@ -31,14 +31,14 @@ namespace OpenRA.Platforms.Default
|
|||||||
return clickHistoryCache[button].LastTapCount();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ namespace OpenRA.Platforms.Default
|
|||||||
KeyInputEvent.Down : KeyInputEvent.Up;
|
KeyInputEvent.Down : KeyInputEvent.Up;
|
||||||
|
|
||||||
var tapCount = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
var tapCount = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
||||||
MultiTapDetection.DetectFromKeyboard(keyCode) :
|
MultiTapDetection.DetectFromKeyboard(keyCode, mods) :
|
||||||
MultiTapDetection.InfoFromKeyboard(keyCode);
|
MultiTapDetection.InfoFromKeyboard(keyCode, mods);
|
||||||
|
|
||||||
var keyEvent = new KeyInput
|
var keyEvent = new KeyInput
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user