From 6be248ca7fc89d915d31b1565a0775014ae6786a Mon Sep 17 00:00:00 2001 From: elperson Date: Tue, 26 May 2026 19:46:27 +0100 Subject: [PATCH 1/9] altgr --- Robust.Client/Input/InputDevices.cs | 1 + Robust.Client/Input/InputManager.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Robust.Client/Input/InputDevices.cs b/Robust.Client/Input/InputDevices.cs index abed7da740b..fbac2fbda60 100644 --- a/Robust.Client/Input/InputDevices.cs +++ b/Robust.Client/Input/InputDevices.cs @@ -174,6 +174,7 @@ public enum Key : byte Pause, World1, CapsLock, + AltGr } public static bool IsMouseKey(this Key key) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 97304880167..7604f1eac63 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -231,6 +231,13 @@ public void KeyDown(KeyEventArgs args) _keysPressed[(int)args.Key] = true; + if (_keysPressed[(int)Key.Alt] && _keysPressed[(int)Key.Control]) + { + _keysPressed[(int)Key.Alt] = false; + _keysPressed[(int)Key.Control] = false; + _keysPressed[(int)Key.AltGr] = true; + } + PackedKeyCombo matchedCombo = default; var bindsDown = new List(); From 3d499720fb57716de2a2f6fe8eefcb1cd23fe946 Mon Sep 17 00:00:00 2001 From: elperson Date: Tue, 26 May 2026 23:20:38 +0100 Subject: [PATCH 2/9] altgr revert, to make good --- Robust.Client/Input/InputDevices.cs | 1 - Robust.Client/Input/InputManager.cs | 7 ------- 2 files changed, 8 deletions(-) diff --git a/Robust.Client/Input/InputDevices.cs b/Robust.Client/Input/InputDevices.cs index fbac2fbda60..abed7da740b 100644 --- a/Robust.Client/Input/InputDevices.cs +++ b/Robust.Client/Input/InputDevices.cs @@ -174,7 +174,6 @@ public enum Key : byte Pause, World1, CapsLock, - AltGr } public static bool IsMouseKey(this Key key) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 7604f1eac63..97304880167 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -231,13 +231,6 @@ public void KeyDown(KeyEventArgs args) _keysPressed[(int)args.Key] = true; - if (_keysPressed[(int)Key.Alt] && _keysPressed[(int)Key.Control]) - { - _keysPressed[(int)Key.Alt] = false; - _keysPressed[(int)Key.Control] = false; - _keysPressed[(int)Key.AltGr] = true; - } - PackedKeyCombo matchedCombo = default; var bindsDown = new List(); From e7ae6b8c7b649b86bda51f1bdc58b5f7fe388689 Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 00:44:39 +0100 Subject: [PATCH 3/9] make it a foreach and lowk done I think --- Robust.Client/Input/IKeyBinding.cs | 2 ++ Robust.Client/Input/InputManager.cs | 33 +++++++++++++++---- Robust.Client/Input/KeyBindingRegistration.cs | 6 ++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Robust.Client/Input/IKeyBinding.cs b/Robust.Client/Input/IKeyBinding.cs index 3eb52673506..0a76010cd7a 100644 --- a/Robust.Client/Input/IKeyBinding.cs +++ b/Robust.Client/Input/IKeyBinding.cs @@ -19,6 +19,8 @@ public interface IKeyBinding bool CanRepeat { get; } bool AllowSubCombs { get; } + bool Strict { get; } + /// /// For a -type binding, /// whether the binding should activate if UI is focused. diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 97304880167..1d1504cd0c7 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -7,6 +7,7 @@ using System.Numerics; using System.Runtime.InteropServices; using System.Text; +using Avalonia.Data; using JetBrains.Annotations; using Robust.Client.UserInterface; using Robust.Shared.Collections; @@ -168,7 +169,8 @@ public void SaveToUserData() Type = p.BindingType, CanFocus = p.CanFocus, CanRepeat = p.CanRepeat, - AllowSubCombs = p.AllowSubCombs + AllowSubCombs = p.AllowSubCombs, + Strict = p.Strict }).ToArray(); var leaveEmpty = _modifiedKeyFunctions @@ -252,7 +254,19 @@ public void KeyDown(KeyEventArgs args) PackedContainsKey(binding.PackedKeyCombo, args.Key)) { matchedCombo = binding.PackedKeyCombo; - + if (binding.Strict) + { + for (Key i=0; i<=Key.CapsLock; i++) + { + if ((i != binding.BaseKey || + i != binding.Mod1 || + i != binding.Mod2 || + i != binding.Mod3) && _keysPressed[(byte)i] == true) + { + return; + } + } + } bindsDown.Add(binding); hasCanFocus |= binding.CanFocus; @@ -597,7 +611,7 @@ public IKeyBinding RegisterBinding(BoundKeyFunction function, KeyBindingType bin Key baseKey, Key? mod1, Key? mod2, Key? mod3) { var binding = new KeyBinding(this, function.FunctionName, bindingType, baseKey, false, false, false, - 0, true, mod1 ?? Key.Unknown, mod2 ?? Key.Unknown, mod3 ?? Key.Unknown); + 0, true, false, mod1 ?? Key.Unknown, mod2 ?? Key.Unknown, mod3 ?? Key.Unknown); RegisterBinding(binding); @@ -608,7 +622,7 @@ public IKeyBinding RegisterBinding(string function, KeyBindingType bindingType, Key baseKey, Key? mod1, Key? mod2, Key? mod3) { var binding = new KeyBinding(this, function, bindingType, baseKey, false, false, false, - 0, true, mod1 ?? Key.Unknown, mod2 ?? Key.Unknown, mod3 ?? Key.Unknown); + 0, true, false, mod1 ?? Key.Unknown, mod2 ?? Key.Unknown, mod3 ?? Key.Unknown); RegisterBinding(binding); @@ -618,7 +632,7 @@ public IKeyBinding RegisterBinding(string function, KeyBindingType bindingType, public IKeyBinding RegisterBinding(in KeyBindingRegistration reg, bool markModified = true, bool invalid = false) { var binding = new KeyBinding(this, reg.Function.FunctionName, reg.Type, reg.BaseKey, reg.CanFocus, reg.CanRepeat, - reg.AllowSubCombs, reg.Priority, reg.CommandWhenUIFocused, reg.Mod1, reg.Mod2, reg.Mod3); + reg.AllowSubCombs, reg.Priority, reg.CommandWhenUIFocused, reg.Strict, reg.Mod1, reg.Mod2, reg.Mod3); RegisterBinding(binding, markModified); @@ -792,13 +806,19 @@ private sealed class KeyBinding : IKeyBinding [ViewVariables] public int Priority { get; internal set; } + /// + /// Whether the Bound Key Combination works when ONLY the specified keys are pressed. + /// + [ViewVariables] + public bool Strict {get; internal set; } + public KeyBinding( InputManager inputManager, string function, KeyBindingType bindingType, Key baseKey, bool canFocus, bool canRepeat, bool allowSubCombs, int priority, - bool commandWhenUIFocused, + bool commandWhenUIFocused, bool strict, Key mod1 = Key.Unknown, Key mod2 = Key.Unknown, Key mod3 = Key.Unknown) @@ -810,6 +830,7 @@ public KeyBinding( AllowSubCombs = allowSubCombs; Priority = priority; CommandWhenUIFocused = commandWhenUIFocused; + Strict = strict; _inputManager = inputManager; PackedKeyCombo = new PackedKeyCombo(baseKey, mod1, mod2, mod3); diff --git a/Robust.Client/Input/KeyBindingRegistration.cs b/Robust.Client/Input/KeyBindingRegistration.cs index f432f1c8c5e..73fd07bc4e0 100644 --- a/Robust.Client/Input/KeyBindingRegistration.cs +++ b/Robust.Client/Input/KeyBindingRegistration.cs @@ -33,5 +33,11 @@ public sealed partial class KeyBindingRegistration /// [DataField] public bool CommandWhenUIFocused { get; set; } = true; + + /// + /// See + /// + [DataField] + public bool Strict = false; } } From 2fa65c2ef2bcb09e839f01d94cbb6f4a9b6b677d Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 11:04:01 +0100 Subject: [PATCH 4/9] foreach epicstyle --- Robust.Client/Input/InputManager.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 1d1504cd0c7..e38542e1ce8 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -256,16 +256,20 @@ public void KeyDown(KeyEventArgs args) matchedCombo = binding.PackedKeyCombo; if (binding.Strict) { - for (Key i=0; i<=Key.CapsLock; i++) + var isStrict = true; + foreach (var key in Enum.GetValues()) { - if ((i != binding.BaseKey || - i != binding.Mod1 || - i != binding.Mod2 || - i != binding.Mod3) && _keysPressed[(byte)i] == true) + if ((key != binding.BaseKey || + key != binding.Mod1 || + key != binding.Mod2 || + key != binding.Mod3) && _keysPressed[(byte)key] == true) { - return; + isStrict = false; + break; } } + if (!isStrict) + continue; } bindsDown.Add(binding); From 092260ab322faac22621ab7c2fd9a32a610786b2 Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 11:18:40 +0100 Subject: [PATCH 5/9] who tf are you --- Robust.Client/Input/InputManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index e38542e1ce8..8ddf0b8dc84 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -7,7 +7,6 @@ using System.Numerics; using System.Runtime.InteropServices; using System.Text; -using Avalonia.Data; using JetBrains.Annotations; using Robust.Client.UserInterface; using Robust.Shared.Collections; From f75bca7172dab06fa24885081bfe307411d99dc4 Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 11:49:14 +0100 Subject: [PATCH 6/9] stupid moment --- Robust.Client/Input/InputManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 8ddf0b8dc84..710278b99c9 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -258,10 +258,10 @@ public void KeyDown(KeyEventArgs args) var isStrict = true; foreach (var key in Enum.GetValues()) { - if ((key != binding.BaseKey || - key != binding.Mod1 || - key != binding.Mod2 || - key != binding.Mod3) && _keysPressed[(byte)key] == true) + if (key != binding.BaseKey && + key != binding.Mod1 && + key != binding.Mod2 && + key != binding.Mod3 && _keysPressed[(int)key] == true) { isStrict = false; break; From 5b27485a6708fb986401f25aae6a72227476edeb Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 12:22:29 +0100 Subject: [PATCH 7/9] maybe the real keybinds were they keys we made along the keyboard --- Robust.Client/Input/IKeyBinding.cs | 2 +- Robust.Client/Input/InputManager.cs | 23 +++++++++---------- Robust.Client/Input/KeyBindingRegistration.cs | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Robust.Client/Input/IKeyBinding.cs b/Robust.Client/Input/IKeyBinding.cs index 0a76010cd7a..61575be4357 100644 --- a/Robust.Client/Input/IKeyBinding.cs +++ b/Robust.Client/Input/IKeyBinding.cs @@ -19,7 +19,7 @@ public interface IKeyBinding bool CanRepeat { get; } bool AllowSubCombs { get; } - bool Strict { get; } + bool StrictModifiers { get; } /// /// For a -type binding, diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 710278b99c9..515f48355c1 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -169,7 +169,7 @@ public void SaveToUserData() CanFocus = p.CanFocus, CanRepeat = p.CanRepeat, AllowSubCombs = p.AllowSubCombs, - Strict = p.Strict + StrictModifiers = p.StrictModifiers }).ToArray(); var leaveEmpty = _modifiedKeyFunctions @@ -253,15 +253,14 @@ public void KeyDown(KeyEventArgs args) PackedContainsKey(binding.PackedKeyCombo, args.Key)) { matchedCombo = binding.PackedKeyCombo; - if (binding.Strict) + if (binding.StrictModifiers) { var isStrict = true; - foreach (var key in Enum.GetValues()) + for (Key i=Key.Control; i - /// Whether the Bound Key Combination works when ONLY the specified keys are pressed. + /// Whether the Bound Key Combination works when ONLY the specified modifier keys are pressed (prevents altgr clashes). /// [ViewVariables] - public bool Strict {get; internal set; } + public bool StrictModifiers {get; internal set; } public KeyBinding( InputManager inputManager, @@ -821,7 +820,7 @@ public KeyBinding( KeyBindingType bindingType, Key baseKey, bool canFocus, bool canRepeat, bool allowSubCombs, int priority, - bool commandWhenUIFocused, bool strict, + bool commandWhenUIFocused, bool strictModifiers, Key mod1 = Key.Unknown, Key mod2 = Key.Unknown, Key mod3 = Key.Unknown) @@ -833,7 +832,7 @@ public KeyBinding( AllowSubCombs = allowSubCombs; Priority = priority; CommandWhenUIFocused = commandWhenUIFocused; - Strict = strict; + StrictModifiers = strictModifiers; _inputManager = inputManager; PackedKeyCombo = new PackedKeyCombo(baseKey, mod1, mod2, mod3); diff --git a/Robust.Client/Input/KeyBindingRegistration.cs b/Robust.Client/Input/KeyBindingRegistration.cs index 73fd07bc4e0..994a4526853 100644 --- a/Robust.Client/Input/KeyBindingRegistration.cs +++ b/Robust.Client/Input/KeyBindingRegistration.cs @@ -35,9 +35,9 @@ public sealed partial class KeyBindingRegistration public bool CommandWhenUIFocused { get; set; } = true; /// - /// See + /// See /// [DataField] - public bool Strict = false; + public bool StrictModifiers = false; } } From 7529dc46e38be8817fd7e1807d4c3d62c326229b Mon Sep 17 00:00:00 2001 From: elperson Date: Wed, 27 May 2026 19:51:51 +0100 Subject: [PATCH 8/9] rerun NOW From 7f00b29948dc15a8a2d6e4c0f53a8b59bde00c0a Mon Sep 17 00:00:00 2001 From: elperson Date: Sat, 30 May 2026 01:55:54 +0100 Subject: [PATCH 9/9] tests will be ran until morale improves