Skip to content

Commit

Permalink
Merge pull request #126 from maimedleech/AddKeyUpFix
Browse files Browse the repository at this point in the history
Make AddKeyUp handle VirtualKeyCode.NUMPAD_RETURN correctly.
  • Loading branch information
Gh0stWalk3r authored Jan 4, 2022
2 parents 5601734 + 6dbecd4 commit c6bcae4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/GregsStack.InputSimulatorStandard/InputBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public InputBuilder AddKeyDown(VirtualKeyCode keyCode)
/// <returns>This <see cref="InputBuilder"/> instance.</returns>
public InputBuilder AddKeyUp(VirtualKeyCode keyCode)
{
var code = (ushort)((int)keyCode & 0xFFFF);
var up =
new Input
{
Expand All @@ -138,8 +139,8 @@ public InputBuilder AddKeyUp(VirtualKeyCode keyCode)
Keyboard =
new KeyboardInput
{
KeyCode = (ushort) keyCode,
Scan = (ushort)(NativeMethods.MapVirtualKey((uint)keyCode, 0) & 0xFFU),
KeyCode = (ushort) code,
Scan = (ushort)(NativeMethods.MapVirtualKey((uint)code, 0) & 0xFFU),
Flags = (uint) (IsExtendedKey(keyCode)
? KeyboardFlag.KeyUp | KeyboardFlag.ExtendedKey
: KeyboardFlag.KeyUp),
Expand Down

0 comments on commit c6bcae4

Please sign in to comment.