From e32fc639c2f2ad06398276dec4587d41177b1e0b Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 22 May 2023 13:20:25 +0200 Subject: [PATCH] fix: Turning off blur again not working --- main/source/window/win_window.cpp | 4 ++-- plugins/builtin/romfs/themes/classic.json | 2 +- plugins/builtin/romfs/themes/dark.json | 2 +- plugins/builtin/source/content/themes.cpp | 4 ++-- .../source/content/views/view_theme_manager.cpp | 14 ++++++++++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/main/source/window/win_window.cpp b/main/source/window/win_window.cpp index 00225c470..423793742 100644 --- a/main/source/window/win_window.cpp +++ b/main/source/window/win_window.cpp @@ -355,8 +355,8 @@ namespace hex { const auto SetWindowCompositionAttribute = (SetWindowCompositionAttributeFunc)(void*)GetProcAddress(user32Dll, "SetWindowCompositionAttribute"); if (SetWindowCompositionAttribute != nullptr) { - ACCENTPOLICY policy = { 3, 0, 0, 0 }; - WINCOMPATTRDATA data = { ImGui::GetCustomStyle().WindowBlur > 0.0F ? 19 : 0, &policy, sizeof(ACCENTPOLICY) }; + ACCENTPOLICY policy = { ImGui::GetCustomStyle().WindowBlur > 0.5F ? 3 : 0, 0, 0, 0 }; + WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) }; SetWindowCompositionAttribute(hwnd, &data); } FreeLibrary(user32Dll); diff --git a/plugins/builtin/romfs/themes/classic.json b/plugins/builtin/romfs/themes/classic.json index f582de7b6..72ad2bca9 100644 --- a/plugins/builtin/romfs/themes/classic.json +++ b/plugins/builtin/romfs/themes/classic.json @@ -56,7 +56,7 @@ "title-background": "#66668CCC", "title-background-active": "#66668CCC", "title-background-collapse": "#66668CCC", - "window-background": "#000000D8" + "window-background": "#000000FF" }, "imhex": { "desc-button": "#282850FF", diff --git a/plugins/builtin/romfs/themes/dark.json b/plugins/builtin/romfs/themes/dark.json index 0c7ba18c7..86bfffabe 100644 --- a/plugins/builtin/romfs/themes/dark.json +++ b/plugins/builtin/romfs/themes/dark.json @@ -56,7 +56,7 @@ "title-background": "#232323FF", "title-background-active": "#232323FF", "title-background-collapse": "#232323FF", - "window-background": "#0F0F0FEF" + "window-background": "#0F0F0FFF" }, "imhex": { "desc-button": "#141414FF", diff --git a/plugins/builtin/source/content/themes.cpp b/plugins/builtin/source/content/themes.cpp index 55d361487..7e56e442f 100644 --- a/plugins/builtin/source/content/themes.cpp +++ b/plugins/builtin/source/content/themes.cpp @@ -240,7 +240,7 @@ namespace hex::plugin::builtin { { auto &style = ImGui::GetStyle(); const static ThemeManager::StyleMap ImGuiStyleMap = { - { "alpha", { &style.Alpha, 0.001F, 1.0F, false } }, + { "alpha", { &style.Alpha, 0.1F, 1.0F, false } }, { "disabled-alpha", { &style.DisabledAlpha, 0.0F, 1.0F, false } }, { "window-padding", { &style.WindowPadding, 0.0F, 20.0F, true } }, { "window-rounding", { &style.WindowRounding, 0.0F, 12.0F, true } }, @@ -330,7 +330,7 @@ namespace hex::plugin::builtin { { auto &style = ImGui::GetCustomStyle(); const static ThemeManager::StyleMap ImHexStyleMap = { - { "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } }, + { "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } }, }; ThemeManager::addStyleHandler("imhex", ImHexStyleMap); diff --git a/plugins/builtin/source/content/views/view_theme_manager.cpp b/plugins/builtin/source/content/views/view_theme_manager.cpp index 4589f689f..9416496eb 100644 --- a/plugins/builtin/source/content/views/view_theme_manager.cpp +++ b/plugins/builtin/source/content/views/view_theme_manager.cpp @@ -27,6 +27,7 @@ namespace hex::plugin::builtin { ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_AlphaPreviewHalf)) { handler.setFunction(colorId, color); + EventManager::post(); } } } @@ -42,10 +43,15 @@ namespace hex::plugin::builtin { for (auto &[styleName, style] : handler.styleMap) { auto &[value, min, max, needsScaling] = style; - if (auto floatValue = std::get_if(&value); floatValue != nullptr) - ImGui::SliderFloat(styleName.c_str(), *floatValue, min, max, "%.1f"); - else if (auto vecValue = std::get_if(&value); vecValue != nullptr) - ImGui::SliderFloat2(styleName.c_str(), &(*vecValue)->x, min, max, "%.1f"); + if (auto floatValue = std::get_if(&value); floatValue != nullptr) { + if (ImGui::SliderFloat(styleName.c_str(), *floatValue, min, max, "%.1f")) { + EventManager::post(); + } + } else if (auto vecValue = std::get_if(&value); vecValue != nullptr) { + if (ImGui::SliderFloat2(styleName.c_str(), &(*vecValue)->x, min, max, "%.1f")) { + EventManager::post(); + } + } } } }