2020-04-10 00:20:19 +08:00
|
|
|
#pragma once
|
|
|
|
#include <interface/lowlevel_keyboard_event_data.h>
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
#include <mutex>
|
2020-04-09 09:14:22 +08:00
|
|
|
#include <windows.h>
|
2020-04-10 00:20:19 +08:00
|
|
|
|
|
|
|
// Wrapper class to handle keyboard layout
|
|
|
|
class LayoutMap
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
// Stores mappings for all the virtual key codes to the name of the key
|
|
|
|
std::map<DWORD, std::wstring> keyboardLayoutMap;
|
|
|
|
std::mutex keyboardLayoutMap_mutex;
|
2020-04-09 09:14:22 +08:00
|
|
|
HKL previousLayout = 0;
|
2020-04-10 00:20:19 +08:00
|
|
|
|
|
|
|
public:
|
2020-04-09 09:14:22 +08:00
|
|
|
// Update Keyboard layout according to input locale identifier
|
|
|
|
void UpdateLayout();
|
|
|
|
|
2020-04-10 00:20:19 +08:00
|
|
|
LayoutMap()
|
|
|
|
{
|
2020-04-09 09:14:22 +08:00
|
|
|
UpdateLayout();
|
2020-04-10 00:20:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Function to return the unicode string name of the key
|
|
|
|
std::wstring GetKeyName(DWORD key);
|
2020-04-09 09:14:22 +08:00
|
|
|
|
2020-04-10 00:20:19 +08:00
|
|
|
};
|