Skip to content

Commit

Permalink
RShift fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Sep 12, 2018
1 parent 794e7b2 commit 2f77d7a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions C#/AutoHotInterception/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public void SendKeyEvent(int id, ushort code, int state)
if (code > 255)
{
code -= 256;
st += 2;
if (code != 54) // RShift has > 256 code, but state is 0/1
{
st += 2;
}
}
stroke.key.code = code;
stroke.key.state = (ushort)st;
Expand Down Expand Up @@ -426,11 +429,11 @@ private void PollThread()
var processMappings = true;
if (code == 54)
{
// Interception seems to report Right Shift as 54 / 0x36...
// Interception seems to report Right Shift as 54 / 0x36 with state 0/1...
// ... this code is normally unused (Alt-SysRq according to linked page) ...
// ... and AHK uses 54 + 256 = 310 (0x36 + 0x100 = 0x136)...
// ... so just keep the key code and behave as if the extended flag was set
state += 2;
// ... so change the code, but leave the state as 0/1
code = 310;
}

// If state is shifted up by 2 (1 or 2 instead of 0 or 1), then this is an "Extended" key code
Expand Down

0 comments on commit 2f77d7a

Please sign in to comment.