From 882d94a22a36d2876ac5f96624f4aee4fc3f9486 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 25 Jul 2010 21:13:42 +1200 Subject: [PATCH] DefaultInputControllerWidget should not ever consume input it doesnt want --- .../Widgets/DefaultInputControllerWidget.cs | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/OpenRA.Game/Widgets/DefaultInputControllerWidget.cs b/OpenRA.Game/Widgets/DefaultInputControllerWidget.cs index 9c63e5bb58..560305948e 100644 --- a/OpenRA.Game/Widgets/DefaultInputControllerWidget.cs +++ b/OpenRA.Game/Widgets/DefaultInputControllerWidget.cs @@ -160,31 +160,37 @@ namespace OpenRA.Widgets if (e.Event == KeyInputEvent.Down) { switch (e.KeyName) - { - case "up": scrollUp = true; break; - case "down": scrollDown = true; break; - case "left": scrollLeft = true; break; - case "right": scrollRight = true; break; + { + case "up": scrollUp = true; return true; + case "down": scrollDown = true; return true; + case "left": scrollLeft = true; return true; + case "right": scrollRight = true; return true; + } + + if (e.KeyName.Length == 1 && char.IsDigit(e.KeyName[0])) + { + Game.world.Selection.DoControlGroup(Game.world, e.KeyName[0] - '0', e.Modifiers); + return true; + } + + if (e.KeyChar == 08) + { + GotoNextBase(); + return true; } - - if (e.KeyName.Length == 1 && char.IsDigit(e.KeyName[0])) - Game.world.Selection.DoControlGroup(Game.world, e.KeyName[0] - '0', e.Modifiers); - - if (e.KeyChar == 08) - GotoNextBase(); } else { switch (e.KeyName) - { - case "up": scrollUp = false; break; - case "down": scrollDown = false; break; - case "left": scrollLeft = false; break; - case "right": scrollRight = false; break; + { + case "up": scrollUp = false; return true; + case "down": scrollDown = false; return true; + case "left": scrollLeft = false; return true; + case "right": scrollRight = false; return true; } } - return true; + return false; } public override void Tick(World world)