2020-08-14 07:32:15 +08:00
|
|
|
#pragma once
|
2021-04-27 03:01:38 +08:00
|
|
|
|
2020-08-14 07:32:15 +08:00
|
|
|
#include <keyboardmanager/common/Helpers.h>
|
|
|
|
|
2021-05-07 16:16:31 +08:00
|
|
|
#include "ShortcutErrorType.h"
|
|
|
|
|
|
|
|
class MappingConfiguration;
|
2020-08-14 07:32:15 +08:00
|
|
|
|
|
|
|
namespace LoadingAndSavingRemappingHelper
|
|
|
|
{
|
|
|
|
// Function to check if the set of remappings in the buffer are valid
|
2021-05-07 16:16:31 +08:00
|
|
|
ShortcutErrorType CheckIfRemappingsAreValid(const RemapBuffer& remappings);
|
2020-08-14 07:32:15 +08:00
|
|
|
|
|
|
|
// Function to return the set of keys that have been orphaned from the remap buffer
|
|
|
|
std::vector<DWORD> GetOrphanedKeys(const RemapBuffer& remappings);
|
|
|
|
|
|
|
|
// Function to combine remappings if the L and R version of the modifier is mapped to the same key
|
2020-10-09 02:28:24 +08:00
|
|
|
void CombineRemappings(std::unordered_map<DWORD, KeyShortcutUnion>& table, DWORD leftKey, DWORD rightKey, DWORD combinedKey);
|
2020-08-14 07:32:15 +08:00
|
|
|
|
|
|
|
// Function to pre process the remap table before loading it into the UI
|
2020-10-09 02:28:24 +08:00
|
|
|
void PreProcessRemapTable(std::unordered_map<DWORD, KeyShortcutUnion>& table);
|
2020-08-14 07:32:15 +08:00
|
|
|
|
|
|
|
// Function to apply the single key remappings from the buffer to the KeyboardManagerState variable
|
2021-05-07 16:16:31 +08:00
|
|
|
void ApplySingleKeyRemappings(MappingConfiguration& mappingConfiguration, const RemapBuffer& remappings, bool isTelemetryRequired);
|
2020-08-14 07:32:15 +08:00
|
|
|
|
|
|
|
// Function to apply the shortcut remappings from the buffer to the KeyboardManagerState variable
|
2021-05-07 16:16:31 +08:00
|
|
|
void ApplyShortcutRemappings(MappingConfiguration& mappingConfiguration, const RemapBuffer& remappings, bool isTelemetryRequired);
|
2020-08-14 07:32:15 +08:00
|
|
|
}
|