mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[runner] rename 'module' variables (#8999)
rename all occurrences of 'module' to 'pt_module' to prevent intellisense error
This commit is contained in:
@@ -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 (...)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<HMODULE, PowertoyModuleDLLDeleter> handle;
|
||||
std::unique_ptr<PowertoyModuleIface, PowertoyModuleDeleter> module;
|
||||
std::unique_ptr<PowertoyModuleIface, PowertoyModuleDeleter> pt_module;
|
||||
};
|
||||
|
||||
PowertoyModule load_powertoy(const std::wstring_view filename);
|
||||
|
||||
Reference in New Issue
Block a user