mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
common: refactor common library pt2 (#8588)
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
This commit is contained in:
51
src/common/interop/keyboard_layout_impl.h
Normal file
51
src/common/interop/keyboard_layout_impl.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "keyboard_layout.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <winrt/Windows.UI.Core.h>
|
||||
|
||||
using namespace winrt;
|
||||
|
||||
// Wrapper class to handle keyboard layout
|
||||
class LayoutMap::LayoutMapImpl
|
||||
{
|
||||
private:
|
||||
// Stores mappings for all the virtual key codes to the name of the key
|
||||
std::mutex keyboardLayoutMap_mutex;
|
||||
|
||||
// Stores the previous layout
|
||||
HKL previousLayout = 0;
|
||||
|
||||
// Stores the keys which have a unicode representation
|
||||
std::map<DWORD, std::wstring> unicodeKeys;
|
||||
|
||||
// Stores the keys which do not have a name
|
||||
std::map<DWORD, std::wstring> unknownKeys;
|
||||
|
||||
// Stores true if the fixed ordering key code list has already been set
|
||||
bool isKeyCodeListGenerated = false;
|
||||
|
||||
// Stores a fixed order key code list for the drop down menus. It is kept fixed to change in ordering due to languages
|
||||
std::vector<DWORD> keyCodeList;
|
||||
|
||||
public:
|
||||
std::map<DWORD, std::wstring> keyboardLayoutMap;
|
||||
|
||||
// Update Keyboard layout according to input locale identifier
|
||||
void UpdateLayout();
|
||||
|
||||
LayoutMapImpl()
|
||||
{
|
||||
UpdateLayout();
|
||||
}
|
||||
|
||||
// Function to return the unicode string name of the key
|
||||
std::wstring GetKeyName(DWORD key);
|
||||
|
||||
// Function to return the list of key codes in the order for the drop down. It creates it if it doesn't exist
|
||||
std::vector<DWORD> GetKeyCodeList(const bool isShortcut);
|
||||
|
||||
// Function to return the list of key name pairs in the order for the drop down based on the key codes
|
||||
std::vector<std::pair<DWORD, std::wstring>> GetKeyNameList(const bool isShortcut);
|
||||
};
|
||||
Reference in New Issue
Block a user