From 0930995b91fa48f8b0f752fd7dbf0c9afc0978d1 Mon Sep 17 00:00:00 2001 From: elvissteinjr Date: Mon, 15 Jul 2024 02:32:03 +0200 Subject: [PATCH] Disable HMD Pointer keyboard settings if HMD Pointer itself is disabled --- src/DesktopPlusUI/WindowSettings.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/DesktopPlusUI/WindowSettings.cpp b/src/DesktopPlusUI/WindowSettings.cpp index f016d3f..34b96b5 100644 --- a/src/DesktopPlusUI/WindowSettings.cpp +++ b/src/DesktopPlusUI/WindowSettings.cpp @@ -1734,16 +1734,19 @@ void WindowSettings::UpdatePageMainCatInput() { ImGui::Indent(); - bool& hmd_pointer = ConfigManager::GetRef(configid_bool_input_laser_pointer_hmd_device); - if (ImGui::Checkbox(TranslationManager::GetString(tstr_SettingsLaserPointerHMDPointer), &hmd_pointer)) + bool& hmd_pointer_enabled = ConfigManager::GetRef(configid_bool_input_laser_pointer_hmd_device); + if (ImGui::Checkbox(TranslationManager::GetString(tstr_SettingsLaserPointerHMDPointer), &hmd_pointer_enabled)) { - IPCManager::Get().PostConfigMessageToDashboardApp(configid_bool_input_laser_pointer_hmd_device, hmd_pointer); + IPCManager::Get().PostConfigMessageToDashboardApp(configid_bool_input_laser_pointer_hmd_device, hmd_pointer_enabled); } - ImGui::PushID("HMDPointer"); - ImGui::Indent(ImGui::GetFrameHeightWithSpacing()); + if (!hmd_pointer_enabled) + ImGui::PushItemDisabled(); + + ImGui::PushID("HMDPointer"); + const ImVec2 table_size(-style.IndentSpacing - 1.0f, 0.0f); //Replicate padding from columns const float table_column_width = m_Column0Width - style.IndentSpacing - ImGui::GetFrameHeightWithSpacing(); //Align with width of other columns @@ -1790,6 +1793,9 @@ void WindowSettings::UpdatePageMainCatInput() ImGui::PopID(); + if (!hmd_pointer_enabled) + ImGui::PopItemDisabled(); + ImGui::Unindent(ImGui::GetFrameHeightWithSpacing()); ImGui::Unindent(); }