| 358 | } |
| 359 | |
| 360 | LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam) { |
| 361 | if (nCode >= 0) |
| 362 | switch (wParam) { |
| 363 | case WM_KEYDOWN: case WM_SYSKEYDOWN: |
| 364 | if (!eve->keyboardSwitchActive) { |
| 365 | for (auto prof = conf->profiles.begin(); prof != conf->profiles.end(); prof++) |
| 366 | if (((LPKBDLLHOOKSTRUCT)lParam)->vkCode == ((*prof)->triggerkey & 0xff) && conf->SamePower(*prof)) { |
| 367 | eve->SwitchActiveProfile(*prof); |
| 368 | eve->keyboardSwitchActive = true; |
| 369 | break; |
| 370 | } |
| 371 | } |
| 372 | break; |
| 373 | case WM_KEYUP: case WM_SYSKEYUP: |
| 374 | if (eve->keyboardSwitchActive && ((LPKBDLLHOOKSTRUCT)lParam)->vkCode == (conf->activeProfile->triggerkey & 0xff)) { |
| 375 | eve->keyboardSwitchActive = false; |
| 376 | eve->CheckProfileChange(); |
| 377 | } |
| 378 | break; |
| 379 | } |
| 380 | |
| 381 | return CallNextHookEx(NULL, nCode, wParam, lParam); |
| 382 | } |
nothing calls this directly
no test coverage detected