GlosSITarget: Only refresh hidHide list if windows is actually open

pull/179/head
Peter Repukat 2 years ago
parent f70cbdbe92
commit a337c0e5a1

@ -189,6 +189,9 @@ void HidHide::UnPatchHook(const std::string& name, HMODULE module)
void HidHide::enableOverlayElement()
{
Overlay::AddOverlayElem([this](bool window_has_focus) {
ImGui::SetNextWindowPos({650, 100}, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSizeConstraints({400, 270}, {1000, 1000});
if (ImGui::Begin("Hidden Devices")) {
if (window_has_focus && (overlay_elem_clock_.getElapsedTime().asSeconds() > OVERLAY_ELEM_REFRESH_INTERVAL_S_)) {
openCtrlDevice();
bool hidehide_state_store = hidhide_active_;
@ -206,9 +209,6 @@ void HidHide::enableOverlayElement()
closeCtrlDevice();
overlay_elem_clock_.restart();
}
ImGui::SetNextWindowPos({650, 100}, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSizeConstraints({400, 270}, {1000, 1000});
ImGui::Begin("Hidden Devices");
ImGui::BeginChild("Inner", {0.f, ImGui::GetItemRectSize().y - 64}, true);
std::ranges::for_each(avail_devices_, [this](const auto& device) {
std::string label = (std::string(device.name.begin(), std::ranges::find(device.name, L'\0')) + "##" + std::string(device.device_instance_path.begin(), device.device_instance_path.end()));
@ -245,6 +245,7 @@ void HidHide::enableOverlayElement()
setActive(hidhide_active_);
closeCtrlDevice();
}
}
ImGui::End();
});
}

Loading…
Cancel
Save