mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +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
|
try
|
||||||
{
|
{
|
||||||
auto module = load_powertoy(moduleSubdir);
|
auto pt_module = load_powertoy(moduleSubdir);
|
||||||
modules().emplace(module->get_key(), std::move(module));
|
modules().emplace(pt_module->get_key(), std::move(pt_module));
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,29 +17,29 @@ PowertoyModule load_powertoy(const std::wstring_view filename)
|
|||||||
FreeLibrary(handle);
|
FreeLibrary(handle);
|
||||||
winrt::throw_last_error();
|
winrt::throw_last_error();
|
||||||
}
|
}
|
||||||
auto module = create();
|
auto pt_module = create();
|
||||||
if (!module)
|
if (!pt_module)
|
||||||
{
|
{
|
||||||
FreeLibrary(handle);
|
FreeLibrary(handle);
|
||||||
winrt::throw_hresult(winrt::hresult(E_POINTER));
|
winrt::throw_hresult(winrt::hresult(E_POINTER));
|
||||||
}
|
}
|
||||||
return PowertoyModule(module, handle);
|
return PowertoyModule(pt_module, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
json::JsonObject PowertoyModule::json_config() const
|
json::JsonObject PowertoyModule::json_config() const
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
module->get_config(nullptr, &size);
|
pt_module->get_config(nullptr, &size);
|
||||||
std::wstring result;
|
std::wstring result;
|
||||||
result.resize(size - 1);
|
result.resize(size - 1);
|
||||||
module->get_config(result.data(), &size);
|
pt_module->get_config(result.data(), &size);
|
||||||
return json::JsonObject::Parse(result);
|
return json::JsonObject::Parse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
PowertoyModule::PowertoyModule(PowertoyModuleIface* module, HMODULE handle) :
|
PowertoyModule::PowertoyModule(PowertoyModuleIface* pt_module, HMODULE handle) :
|
||||||
handle(handle), module(module)
|
handle(handle), pt_module(pt_module)
|
||||||
{
|
{
|
||||||
if (!module)
|
if (!pt_module)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Module not initialized");
|
throw std::runtime_error("Module not initialized");
|
||||||
}
|
}
|
||||||
@@ -49,17 +49,17 @@ PowertoyModule::PowertoyModule(PowertoyModuleIface* module, HMODULE handle) :
|
|||||||
|
|
||||||
void PowertoyModule::update_hotkeys()
|
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);
|
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++)
|
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);
|
return modulePtr->on_hotkey(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
struct PowertoyModuleDeleter
|
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
|
class PowertoyModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PowertoyModule(PowertoyModuleIface* module, HMODULE handle);
|
PowertoyModule(PowertoyModuleIface* pt_module, HMODULE handle);
|
||||||
|
|
||||||
inline PowertoyModuleIface* operator->()
|
inline PowertoyModuleIface* operator->()
|
||||||
{
|
{
|
||||||
return module.get();
|
return pt_module.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
json::JsonObject json_config() const;
|
json::JsonObject json_config() const;
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<HMODULE, PowertoyModuleDLLDeleter> handle;
|
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);
|
PowertoyModule load_powertoy(const std::wstring_view filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user