Skip to content

Commit

Permalink
Merge pull request #97 from silverlore/master
Browse files Browse the repository at this point in the history
Fix problem with numpad_return and return being treaded as the same key
  • Loading branch information
Gh0stWalk3r authored Mar 3, 2021
2 parents f48662f + 1078e01 commit 8d46cbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/GregsStack.InputSimulatorStandard/InputBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public InputBuilder()
/// <returns>This <see cref="InputBuilder"/> instance.</returns>
public InputBuilder AddKeyDown(VirtualKeyCode keyCode)
{
var code = (ushort)((int)keyCode & 0xFFFF);
var down =
new Input
{
Expand All @@ -108,8 +109,8 @@ public InputBuilder AddKeyDown(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 = IsExtendedKey(keyCode) ? (uint) KeyboardFlag.ExtendedKey : 0,
Time = 0,
ExtraInfo = IntPtr.Zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public enum VirtualKeyCode
/// <summary>
/// Numeric keypad ENTER key
/// </summary>
NUMPAD_RETURN = 0x0D,
NUMPAD_RETURN = 0x4000000D,

// 0x0E - 0x0F : Undefined

Expand Down Expand Up @@ -940,5 +940,7 @@ public enum VirtualKeyCode
/// Clear key
/// </summary>
OEM_CLEAR = 0xFE,


}
}

0 comments on commit 8d46cbb

Please sign in to comment.