From cb682b6e21a20d067222b5f011d5bc31782df96d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 5 Sep 2022 14:16:31 +0200 Subject: [PATCH] ui: Fixed graphics artifacts on welcome screen --- lib/external/imgui/include/imconfig.h | 2 +- lib/libimhex/source/api/imhex_api.cpp | 4 ++-- plugins/builtin/source/content/welcome_screen.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/external/imgui/include/imconfig.h b/lib/external/imgui/include/imconfig.h index 2f620c982..d68656e39 100644 --- a/lib/external/imgui/include/imconfig.h +++ b/lib/external/imgui/include/imconfig.h @@ -99,7 +99,7 @@ // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. -//#define ImDrawIdx unsigned int +#define ImDrawIdx unsigned int //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) //struct ImDrawList; diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 417ba6a41..a9c63089c 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -208,7 +208,7 @@ namespace hex { namespace ImHexApi::Provider { - static u32 s_currentProvider = std::numeric_limits::max(); + static i64 s_currentProvider = -1; static std::vector s_providers; namespace impl { @@ -247,7 +247,7 @@ namespace hex { } bool isValid() { - return !s_providers.empty() && s_currentProvider < s_providers.size(); + return !s_providers.empty() && s_currentProvider < i64(s_providers.size()); } void markDirty() { diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 888f1d1a5..e298b93e0 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -369,8 +369,6 @@ namespace hex::plugin::builtin { } static void drawNoViewsBackground() { - if (isAnyViewOpen() && ImHexApi::Provider::isValid()) return; - if (ImGui::Begin("ImHexDockSpace")) { static char title[256]; ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("ImHexMainDock")); @@ -395,7 +393,10 @@ namespace hex::plugin::builtin { updateRecentProviders(); (void)EventManager::subscribe(drawWelcomeScreen); - (void)EventManager::subscribe(drawNoViewsBackground); + (void)EventManager::subscribe([]{ + if (ImHexApi::Provider::isValid() && !isAnyViewOpen()) + drawNoViewsBackground(); + }); (void)EventManager::subscribe([]() { {