mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[KBM] Migrate Engine and Editor into separate processes (#10774)
* Move KBM engine into separate process (#10672) * [KBM] Migrate KBM UI out of the runner (#10709) * Clean up keyboard hook handles (#10817) * [C++ common] Unhandled exception handler (#10821) * [KBM] Use icon in the KeyboardManagerEditor (#10845) * [KBM] Move resources from the Common project to the Editor. (#10844) * KBM Editor tests (#10858) * Rename engine executable (#10868) * clean up (#10870) * [KBM] Changed Editor and libraries output folders (#10871) * [KBM] New logs structure (#10872) * Add unhandled exception handling to the editor (#10874) * [KBM] Trace for edit keyboard window * Logging for XamlBridge message loop * [KBM] Added Editor and Engine to the installer (#10876) * Fix spelling * Interprocess communication logs, remove unnecessary windows message logs * [KBM] Separated telemetry for the engine and editor. (#10889) * [KBM] Editor test project (#10891) * Versions for the engine and the editor (#10897) * Add the editor's and the engine's executables to signing process (#10900) * [KBM editor] Run only one instance, exit when parent process exits (#10890) * [KBM] Force kill editor process to avoid XAML crash (#10907) * [KBM] Force kill editor process to avoid XAML crash * Fix event releasing Co-authored-by: mykhailopylyp <17161067+mykhailopylyp@users.noreply.github.com> * Make the editor dpi aware (#10908) * [KBM] KeyboardManagerCommon refactoring (#10909) * Do not start the process if it is already started (#10910) * logs * Update src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp * Update src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp * [KBM] Rename InitUnhandledExceptionHandler to make it explicit that is for x64 only. We will fix it properly when adding support for ARM64 and add a header with the proper conditional building. * [KBM] rename file/class/variables using camel case * [KBM] Rename "event_locker" -> "EventLocker" * [KBM] rename process_waiter Add a TODO comment * [KBM] rename methods Add TODO comment * [KBM] use uppercase for function names * [KBM] use uppercase for methos, lowercase for properties * [KBM] rename method, make methods private, formatting * [KBM] rename private variables * [KBM] use uppercase for function names * [KBM] Added support to run the editor stand-alone when built in debug mode * Update src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.cpp * Check success of event creation, comment (#10947) * [KBM] code formatting (#10951) * [KBM] code formatting * Update src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp * [KBM] tracing * [KBM] Remappings not showing fix. (#10954) * removed mutex * retry loop for reading * retry on reading config once * log error Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com> Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com> Co-authored-by: Seraphima Zykova <zykovas91@gmail.com> Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com>
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "Helpers.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <common/interop/keyboard_layout.h>
|
||||
#include <common/interop/shared_constants.h>
|
||||
#include <common/utils/process_path.h>
|
||||
#include <common/utils/resources.h>
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include "keyboardmanager/dll/Generated Files/resource.h"
|
||||
#include <common/interop/keyboard_layout.h>
|
||||
#include "ErrorTypes.h"
|
||||
#include "KeyboardManagerConstants.h"
|
||||
|
||||
using namespace winrt::Windows::Foundation;
|
||||
@@ -30,17 +25,6 @@ namespace KeyboardManagerHelper
|
||||
return splittedStrings;
|
||||
}
|
||||
|
||||
// Function to return the next sibling element for an element under a stack panel
|
||||
IInspectable getSiblingElement(IInspectable const& element)
|
||||
{
|
||||
FrameworkElement frameworkElement = element.as<FrameworkElement>();
|
||||
StackPanel parentElement = frameworkElement.Parent().as<StackPanel>();
|
||||
uint32_t index;
|
||||
|
||||
parentElement.Children().IndexOf(frameworkElement, index);
|
||||
return parentElement.Children().GetAt(index + 1);
|
||||
}
|
||||
|
||||
// Function to check if the key is a modifier key
|
||||
bool IsModifierKey(DWORD key)
|
||||
{
|
||||
@@ -100,20 +84,6 @@ namespace KeyboardManagerHelper
|
||||
}
|
||||
}
|
||||
|
||||
Collections::IVector<IInspectable> ToBoxValue(const std::vector<std::pair<DWORD, std::wstring>>& list)
|
||||
{
|
||||
Collections::IVector<IInspectable> boxList = single_threaded_vector<IInspectable>();
|
||||
for (auto& val : list)
|
||||
{
|
||||
auto comboBox = ComboBoxItem();
|
||||
comboBox.DataContext(winrt::box_value(std::to_wstring(val.first)));
|
||||
comboBox.Content(winrt::box_value(val.second));
|
||||
boxList.Append(winrt::box_value(comboBox));
|
||||
}
|
||||
|
||||
return boxList;
|
||||
}
|
||||
|
||||
// Function to check if two keys are equal or cover the same set of keys. Return value depends on type of overlap
|
||||
ErrorType DoKeysOverlap(DWORD first, DWORD second)
|
||||
{
|
||||
@@ -141,52 +111,6 @@ namespace KeyboardManagerHelper
|
||||
}
|
||||
}
|
||||
|
||||
// Function to return the error message
|
||||
winrt::hstring GetErrorMessage(ErrorType errorType)
|
||||
{
|
||||
switch (errorType)
|
||||
{
|
||||
case ErrorType::NoError:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_REMAPSUCCESSFUL).c_str();
|
||||
case ErrorType::SameKeyPreviouslyMapped:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAMEKEYPREVIOUSLYMAPPED).c_str();
|
||||
case ErrorType::MapToSameKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAPPEDTOSAMEKEY).c_str();
|
||||
case ErrorType::ConflictingModifierKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CONFLICTINGMODIFIERKEY).c_str();
|
||||
case ErrorType::SameShortcutPreviouslyMapped:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAMESHORTCUTPREVIOUSLYMAPPED).c_str();
|
||||
case ErrorType::MapToSameShortcut:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAPTOSAMESHORTCUT).c_str();
|
||||
case ErrorType::ConflictingModifierShortcut:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CONFLICTINGMODIFIERSHORTCUT).c_str();
|
||||
case ErrorType::WinL:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_WINL).c_str();
|
||||
case ErrorType::CtrlAltDel:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CTRLALTDEL).c_str();
|
||||
case ErrorType::RemapUnsuccessful:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_REMAPUNSUCCESSFUL).c_str();
|
||||
case ErrorType::SaveFailed:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAVEFAILED).c_str();
|
||||
case ErrorType::ShortcutStartWithModifier:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTSTARTWITHMODIFIER).c_str();
|
||||
case ErrorType::ShortcutCannotHaveRepeatedModifier:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTNOREPEATEDMODIFIER).c_str();
|
||||
case ErrorType::ShortcutAtleast2Keys:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTATLEAST2KEYS).c_str();
|
||||
case ErrorType::ShortcutOneActionKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTONEACTIONKEY).c_str();
|
||||
case ErrorType::ShortcutNotMoreThanOneActionKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTMAXONEACTIONKEY).c_str();
|
||||
case ErrorType::ShortcutMaxShortcutSizeOneActionKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAXSHORTCUTSIZE).c_str();
|
||||
case ErrorType::ShortcutDisableAsActionKey:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_DISABLEASACTIONKEY).c_str();
|
||||
default:
|
||||
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_DEFAULT).c_str();
|
||||
}
|
||||
}
|
||||
|
||||
// Function to set the value of a key event based on the arguments
|
||||
void SetKeyEvent(LPINPUT keyEventArray, int index, DWORD inputType, WORD keyCode, DWORD flags, ULONG_PTR extraInfo)
|
||||
{
|
||||
@@ -363,12 +287,4 @@ namespace KeyboardManagerHelper
|
||||
// If we have at least two keys equal to 'selectedKeyCode' than modifier was repeated
|
||||
return numberOfSameType > 1;
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::IInspectable GetWrapped(const winrt::Windows::Foundation::IInspectable& element, double width)
|
||||
{
|
||||
StackPanel sp = StackPanel();
|
||||
sp.Width(width);
|
||||
sp.Children().Append(element.as<FrameworkElement>());
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user