[runner] rename 'module' variables (#8999)

rename all occurrences of 'module' to 'pt_module' to prevent intellisense error
This commit is contained in:
Enrico Giordani
2021-01-08 19:26:38 +01:00
committed by GitHub
parent cccd2c0139
commit dbda4d50bd
3 changed files with 21 additions and 21 deletions

View File

@@ -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<PowertoyModuleIface::Hotkey> 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);
});
}