mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Quite possibly break the whole input system.
Made it so keybinds don't block other keybinds from firing. Why is this necessary? This allows us to have "same keybind, different functionality" binds sanely, like shift click being both TextCursorSelect and (in content) ExamineEntity. Before this change the latter was temporarily broken in UI controls because of TextCursorSelect taking priority and instantly treating the event as handled because it's CanFocus. The offshoot of this is that all the "args.CanFocus == mouse left" UI code had to be fixed, since multiple things were now firing for that and breaking everything. For example TextCursorSelect actually BROKE because now ExamineEntity was firing inside UI again and that was seen as a left click. EngineKeyFunctions.UIClick has been introduced as "mouse left for the UI" for this purpose.
This commit is contained in:
@@ -15,6 +15,7 @@ namespace Robust.Client.Input
|
||||
{
|
||||
var common = contexts.GetContext(InputContextContainer.DefaultContextName);
|
||||
common.AddFunction(EngineKeyFunctions.Use);
|
||||
common.AddFunction(EngineKeyFunctions.UIClick);
|
||||
|
||||
common.AddFunction(EngineKeyFunctions.EscapeMenu);
|
||||
common.AddFunction(EngineKeyFunctions.HideUI);
|
||||
|
||||
@@ -138,8 +138,7 @@ namespace Robust.Client.Input
|
||||
{
|
||||
matchedCombo = binding.PackedKeyCombo;
|
||||
|
||||
if (DownBind(binding))
|
||||
break;
|
||||
DownBind(binding);
|
||||
}
|
||||
else if (PackedIsSubPattern(matchedCombo, binding.PackedKeyCombo))
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Robust.Client.UserInterface.Controls
|
||||
@@ -106,7 +107,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a button enables Keybinds without GUIBoundKeyEventArgs.CanFocus to trigger the button.
|
||||
/// Whether key functions other than <see cref="EngineKeyFunctions.UIClick"/> trigger the button.
|
||||
/// </summary>
|
||||
public bool EnableAllKeybinds
|
||||
{
|
||||
@@ -198,7 +199,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (Disabled || (!_enableAllKeybinds && !args.CanFocus))
|
||||
if (Disabled || (!_enableAllKeybinds && args.Function != EngineKeyFunctions.UIClick))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -241,7 +242,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindUp(args);
|
||||
|
||||
if (Disabled || (!_enableAllKeybinds && !args.CanFocus))
|
||||
if (Disabled || (!_enableAllKeybinds && args.Function != EngineKeyFunctions.UIClick))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (SelectMode == ItemListSelectMode.None || !args.CanFocus)
|
||||
if (SelectMode == ItemListSelectMode.None || args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick && args.Function != EngineKeyFunctions.TextCursorSelect)
|
||||
{
|
||||
if (!HasKeyboardFocus())
|
||||
{
|
||||
@@ -535,7 +535,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindUp(args);
|
||||
|
||||
if (args.CanFocus)
|
||||
if (args.Function == EngineKeyFunctions.UIClick || args.Function == EngineKeyFunctions.TextCursorSelect)
|
||||
{
|
||||
_mouseSelectingText = false;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindUp(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Maths;
|
||||
using static Robust.Client.UserInterface.Controls.LayoutContainer;
|
||||
|
||||
@@ -117,7 +118,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -130,7 +131,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindUp(args);
|
||||
|
||||
if (args.CanFocus)
|
||||
if (args.Function == EngineKeyFunctions.UIClick)
|
||||
{
|
||||
_grabbed = false;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -242,7 +243,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!TabsVisible || !args.CanFocus)
|
||||
if (!TabsVisible || args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Client.UserInterface.Controls
|
||||
@@ -89,7 +90,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -153,7 +154,7 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -173,7 +174,7 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
{
|
||||
base.KeyBindUp(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.ViewVariables.Editors;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -146,7 +147,7 @@ namespace Robust.Client.ViewVariables
|
||||
{
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Robust.Shared.Input
|
||||
public static readonly BoundKeyFunction CameraRotateLeft = "CameraRotateLeft";
|
||||
|
||||
public static readonly BoundKeyFunction Use = "Use";
|
||||
public static readonly BoundKeyFunction UIClick = "UIClick";
|
||||
|
||||
public static readonly BoundKeyFunction ShowDebugConsole = "ShowDebugConsole";
|
||||
public static readonly BoundKeyFunction ShowDebugMonitors = "ShowDebugMonitors";
|
||||
|
||||
Reference in New Issue
Block a user