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() void HidHide::enableOverlayElement()
{ {
Overlay::AddOverlayElem([this](bool window_has_focus) { 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_)) { if (window_has_focus && (overlay_elem_clock_.getElapsedTime().asSeconds() > OVERLAY_ELEM_REFRESH_INTERVAL_S_)) {
openCtrlDevice(); openCtrlDevice();
bool hidehide_state_store = hidhide_active_; bool hidehide_state_store = hidhide_active_;
@ -206,9 +209,6 @@ void HidHide::enableOverlayElement()
closeCtrlDevice(); closeCtrlDevice();
overlay_elem_clock_.restart(); 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); ImGui::BeginChild("Inner", {0.f, ImGui::GetItemRectSize().y - 64}, true);
std::ranges::for_each(avail_devices_, [this](const auto& device) { 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())); 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_); setActive(hidhide_active_);
closeCtrlDevice(); closeCtrlDevice();
} }
}
ImGui::End(); ImGui::End();
}); });
} }

Loading…
Cancel
Save