mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
logs (#10462)
This commit is contained in:
@@ -345,6 +345,12 @@ public:
|
||||
void terminateProcess()
|
||||
{
|
||||
Logger::trace(L"Terminating PowerToys Run process. Handle {}.", m_hProcess);
|
||||
if (WaitForSingleObject(m_hProcess, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
Logger::warn("PowerToys Run has exited unexpectedly, so there is no need to terminate it.");
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD processID = GetProcessId(m_hProcess);
|
||||
if (TerminateProcess(m_hProcess, 1) == 0)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "centralized_kb_hook.h"
|
||||
#include <common/debug_control.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
namespace CentralizedKeyboardHook
|
||||
{
|
||||
@@ -79,12 +80,14 @@ namespace CentralizedKeyboardHook
|
||||
|
||||
void SetHotkeyAction(const std::wstring& moduleName, const Hotkey& hotkey, std::function<bool()>&& action) noexcept
|
||||
{
|
||||
Logger::trace(L"Register hotkey action for {}", moduleName);
|
||||
std::unique_lock lock{ mutex };
|
||||
hotkeyDescriptors.insert({ .hotkey = hotkey, .moduleName = moduleName, .action = std::move(action) });
|
||||
}
|
||||
|
||||
void ClearModuleHotkeys(const std::wstring& moduleName) noexcept
|
||||
{
|
||||
Logger::trace(L"UnRegister hotkey action for {}", moduleName);
|
||||
std::unique_lock lock{ mutex };
|
||||
auto it = hotkeyDescriptors.begin();
|
||||
while (it != hotkeyDescriptors.end())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "powertoy_module.h"
|
||||
#include "centralized_kb_hook.h"
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
std::map<std::wstring, PowertoyModule>& modules()
|
||||
{
|
||||
@@ -60,6 +61,7 @@ void PowertoyModule::update_hotkeys()
|
||||
for (size_t i = 0; i < hotkeyCount; i++)
|
||||
{
|
||||
CentralizedKeyboardHook::SetHotkeyAction(pt_module->get_key(), hotkeys[i], [modulePtr, i] {
|
||||
Logger::trace(L"{} hotkey is invoked from Centralized keyboard hook", modulePtr->get_key());
|
||||
return modulePtr->on_hotkey(i);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user