-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the KeyCode.Unknown
#3055
Comments
@tig I also have another suggestion that could be done in this issue or open a new issue if you want. |
On Windows (and maybe other platforms in the future) it is possible to detect a "Shift Key" (Shift, Ctrl, or Alt) press. We should not arbitrarily prevent devs from doing so. So, as long as the driver doesn't include the CtrlShift mask with the "Ctrl" key event, I agree. Here I
Also, in the new world, this is better syntax for what you suggest: /// <summary>
/// Indicates whether the <see cref="Key"/> is valid or not. Invalid keys are <see cref="Key.Empty"/>,
/// and keys with only shift modifiers.
/// </summary>
public bool IsValid => this != Empty && (NoAlt.NoShift.NoCtrl != Empty); Unit tests: // IsValid
[Theory]
[InlineData (KeyCode.A, true)]
[InlineData (KeyCode.B, true)]
[InlineData (KeyCode.F1 | KeyCode.ShiftMask, true)]
[InlineData (KeyCode.Null, false)]
[InlineData (KeyCode.ShiftMask, false)]
[InlineData (KeyCode.CtrlMask, false)]
[InlineData (KeyCode.AltMask, false)]
[InlineData (KeyCode.ShiftMask | KeyCode.AltMask, false)]
public void IsValid (Key key, bool expected) => Assert.Equal (expected, key.IsValid); |
I can have a PR ready for this in a few min. Unless you already have one ready. |
I'm trying to fix the |
Almost ready. |
* Simplifies Key.IsValid * Updated unit tests * Fixed menu
I think it should also been removed from the
KeyCode
enum.Originally posted by @BDisp in #2927 (comment)
The text was updated successfully, but these errors were encountered: