Skip to content

Commit

Permalink
set extended key bit when injecting the right alt key
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGyver83 committed Jul 20, 2021
1 parent f56749c commit dcfa398
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ void sendChar(TCHAR key, KBDLLHOOKSTRUCT keyInfo) {
// Furthermore, use unicode for number keys.
sendUnicodeChar(key, keyInfo);
} else {
keyInfo.vkCode = keyScanResult;
keyInfo.vkCode = keyScanResult & 0xff;
char modifiers = keyScanResult >> 8;
bool shift = ((modifiers & 1) != 0);
bool alt = ((modifiers & 2) != 0);
Expand All @@ -822,14 +822,14 @@ void sendChar(TCHAR key, KBDLLHOOKSTRUCT keyInfo) {
alt = false;
}

if (altgr) sendDown(VK_RMENU, 56, false);
if (altgr) sendDown(VK_RMENU, 56, true);
if (ctrl) sendDown(VK_CONTROL, 29, false);
if (alt) sendDown(VK_MENU, 56, false); // ALT
if (shift) sendDown(VK_SHIFT, 42, false);

keybd_event(keyInfo.vkCode, keyInfo.scanCode, dwFlagsFromKeyInfo(keyInfo), keyInfo.dwExtraInfo);

if (altgr) sendUp(VK_RMENU, 56, false);
if (altgr) sendUp(VK_RMENU, 56, true);
if (ctrl) sendUp(VK_CONTROL, 29, false);
if (alt) sendUp(VK_MENU, 56, false); // ALT
if (shift) sendUp(VK_SHIFT, 42, false);
Expand Down Expand Up @@ -1636,7 +1636,7 @@ int main(int argc, char *argv[]) {
}
}
}
// tranform possibly UTF-8 encoded custom layout string to UTF-16
// transform possibly UTF-8 encoded custom layout string to UTF-16
str2wcs(customLayoutWcs, customLayout, 33);

if (quoteAsMod3R)
Expand Down

0 comments on commit dcfa398

Please sign in to comment.