/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/keyboardmanager/common/KeyboardEventHandlers.cpp
20 строк
1 KB
Masaru Iritani
[KBM][CQ]Replace LPINPUT with std::vector<INPUT> (#32052)
22 июн 2024, 00:16
Не верифицирован
22 июн 2024, 00:16
62c7b0a
Код
Авторство
О чём код?
#include "pch.h" #include "KeyboardEventHandlers.h" #include <keyboardmanager/common/InputInterface.h> #include <keyboardmanager/common/Helpers.h> #include <keyboardmanager/common/KeyboardManagerConstants.h> namespace KeyboardEventHandlers { // Function to ensure Num Lock state does not change when it is suppressed by the low level hook void SetNumLockToPreviousState(KeyboardManagerInput::InputInterface& ii) { // Num Lock's key state is applied before it is intercepted by low level keyboard hooks, so we have to manually set back the state when we suppress the key. This is done by sending an additional key up, key down set of messages. std::vector<INPUT> keyEventList; // Use the suppress flag to ensure these are not intercepted by any remapped keys or shortcuts Helpers::SetKeyEvent(keyEventList, INPUT_KEYBOARD, VK_NUMLOCK, KEYEVENTF_KEYUP, KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG); Helpers::SetKeyEvent(keyEventList, INPUT_KEYBOARD, VK_NUMLOCK, 0, KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG); ii.SendVirtualInput(keyEventList); } }