diff --git a/src/runner/main.cpp b/src/runner/main.cpp index 98c60f54bf..393ce3c490 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -138,8 +138,8 @@ int runner(bool isProcessElevated) { try { - auto module = load_powertoy(moduleSubdir); - modules().emplace(module->get_key(), std::move(module)); + auto pt_module = load_powertoy(moduleSubdir); + modules().emplace(pt_module->get_key(), std::move(pt_module)); } catch (...) { diff --git a/src/runner/powertoy_module.cpp b/src/runner/powertoy_module.cpp index 220911b954..7db2b15e03 100644 --- a/src/runner/powertoy_module.cpp +++ b/src/runner/powertoy_module.cpp @@ -17,29 +17,29 @@ PowertoyModule load_powertoy(const std::wstring_view filename) FreeLibrary(handle); winrt::throw_last_error(); } - auto module = create(); - if (!module) + auto pt_module = create(); + if (!pt_module) { FreeLibrary(handle); winrt::throw_hresult(winrt::hresult(E_POINTER)); } - return PowertoyModule(module, handle); + return PowertoyModule(pt_module, handle); } json::JsonObject PowertoyModule::json_config() const { int size = 0; - module->get_config(nullptr, &size); + pt_module->get_config(nullptr, &size); std::wstring result; result.resize(size - 1); - module->get_config(result.data(), &size); + pt_module->get_config(result.data(), &size); return json::JsonObject::Parse(result); } -PowertoyModule::PowertoyModule(PowertoyModuleIface* module, HMODULE handle) : - handle(handle), module(module) +PowertoyModule::PowertoyModule(PowertoyModuleIface* pt_module, HMODULE handle) : + handle(handle), pt_module(pt_module) { - if (!module) + if (!pt_module) { throw std::runtime_error("Module not initialized"); } @@ -49,17 +49,17 @@ PowertoyModule::PowertoyModule(PowertoyModuleIface* module, HMODULE handle) : void PowertoyModule::update_hotkeys() { - CentralizedKeyboardHook::ClearModuleHotkeys(module->get_key()); + CentralizedKeyboardHook::ClearModuleHotkeys(pt_module->get_key()); - size_t hotkeyCount = module->get_hotkeys(nullptr, 0); + size_t hotkeyCount = pt_module->get_hotkeys(nullptr, 0); std::vector hotkeys(hotkeyCount); - module->get_hotkeys(hotkeys.data(), hotkeyCount); + pt_module->get_hotkeys(hotkeys.data(), hotkeyCount); - auto modulePtr = module.get(); + auto modulePtr = pt_module.get(); for (size_t i = 0; i < hotkeyCount; i++) { - CentralizedKeyboardHook::SetHotkeyAction(module->get_key(), hotkeys[i], [modulePtr, i] { + CentralizedKeyboardHook::SetHotkeyAction(pt_module->get_key(), hotkeys[i], [modulePtr, i] { return modulePtr->on_hotkey(i); }); } diff --git a/src/runner/powertoy_module.h b/src/runner/powertoy_module.h index 4c55b004f8..8c3e499b32 100644 --- a/src/runner/powertoy_module.h +++ b/src/runner/powertoy_module.h @@ -10,11 +10,11 @@ struct PowertoyModuleDeleter { - void operator()(PowertoyModuleIface* module) const + void operator()(PowertoyModuleIface* pt_module) const { - if (module) + if (pt_module) { - module->destroy(); + pt_module->destroy(); } } }; @@ -31,11 +31,11 @@ struct PowertoyModuleDLLDeleter class PowertoyModule { public: - PowertoyModule(PowertoyModuleIface* module, HMODULE handle); + PowertoyModule(PowertoyModuleIface* pt_module, HMODULE handle); inline PowertoyModuleIface* operator->() { - return module.get(); + return pt_module.get(); } json::JsonObject json_config() const; @@ -44,7 +44,7 @@ public: private: std::unique_ptr handle; - std::unique_ptr module; + std::unique_ptr pt_module; }; PowertoyModule load_powertoy(const std::wstring_view filename);