diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 29f884cd7c..a6ab5f21dd 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -239,7 +239,6 @@ - @@ -351,5 +350,5 @@ false - - + + \ No newline at end of file diff --git a/OpenRA.Game/Widgets/RootWidget.cs b/OpenRA.Game/Widgets/RootWidget.cs deleted file mode 100644 index b3dea3a885..0000000000 --- a/OpenRA.Game/Widgets/RootWidget.cs +++ /dev/null @@ -1,55 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2017 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using OpenRA.Graphics; - -namespace OpenRA.Widgets -{ - public class RootWidget : ContainerWidget - { - public RootWidget() - { - IgnoreMouseOver = true; - } - - public override bool HandleKeyPress(KeyInput e) - { - if (e.Event == KeyInputEvent.Down) - { - var hk = Hotkey.FromKeyInput(e); - - if (hk == Game.Settings.Keys.DevReloadChromeKey) - { - ChromeProvider.Initialize(Game.ModData); - return true; - } - - if (hk == Game.Settings.Keys.HideUserInterfaceKey) - { - foreach (var child in Children) - child.Visible ^= true; - - return true; - } - - if (hk == Game.Settings.Keys.TakeScreenshotKey) - { - if (e.Event == KeyInputEvent.Down) - Game.TakeScreenshot = true; - - return true; - } - } - - return base.HandleKeyPress(e); - } - } -} diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 4cbda54be8..ca7e85bb7b 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -20,7 +20,7 @@ namespace OpenRA.Widgets { public static class Ui { - public static Widget Root = new RootWidget(); + public static Widget Root = new ContainerWidget(); public static long LastTickTime = Game.RunTime; @@ -128,6 +128,29 @@ namespace OpenRA.Widgets /// Key input data public static bool HandleKeyPress(KeyInput e) { + if (e.Event == KeyInputEvent.Down) + { + var hk = Hotkey.FromKeyInput(e); + + if (hk == Game.Settings.Keys.DevReloadChromeKey) + { + ChromeProvider.Initialize(Game.ModData); + return true; + } + + if (hk == Game.Settings.Keys.HideUserInterfaceKey) + { + Root.Visible ^= true; + return true; + } + + if (hk == Game.Settings.Keys.TakeScreenshotKey) + { + Game.TakeScreenshot = true; + return true; + } + } + if (KeyboardFocusWidget != null) return KeyboardFocusWidget.HandleKeyPressOuter(e);