diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index 90e87120..9a516055 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -118,7 +118,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls ImGui_ImplWin32_Init(hwnd); diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index 77cc1640..54985b89 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -136,7 +136,7 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; io.ConfigFlags |= ImGuiConfigFlags_EnableDpiScaleFonts; io.ConfigFlags |= ImGuiConfigFlags_EnableDpiScaleViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls ImGui_ImplWin32_Init(hwnd); diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp index f7e16a47..951be7f9 100644 --- a/examples/imgui_impl_glfw.cpp +++ b/examples/imgui_impl_glfw.cpp @@ -410,8 +410,7 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport) #if defined(_WIN32) // GLFW hack: Hide icon from task bar HWND hwnd = glfwGetWin32Window(data->Window); - ImGuiIO& io = ImGui::GetIO(); - if (io.ConfigFlags & ImGuiConfigFlags_NoTaskBarForViewports) + if (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon) { LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); ex_style &= ~WS_EX_APPWINDOW; diff --git a/examples/imgui_impl_sdl2.cpp b/examples/imgui_impl_sdl2.cpp index e720ca9d..35443fbf 100644 --- a/examples/imgui_impl_sdl2.cpp +++ b/examples/imgui_impl_sdl2.cpp @@ -353,8 +353,7 @@ static void ImGui_ImplSDL2_ShowWindow(ImGuiViewport* viewport) // SDL hack: Hide icon from task bar // Note: SDL 2.0.6+ has a SDL_WINDOW_SKIP_TASKBAR flag which is supported under Windows but the way it create the window breaks our seamless transition. - ImGuiIO& io = ImGui::GetIO(); - if (io.ConfigFlags & ImGuiConfigFlags_NoTaskBarForViewports) + if (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon) { LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); ex_style &= ~WS_EX_APPWINDOW; diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index 411e5295..75ccbb77 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -377,18 +377,17 @@ static void ImGui_ImplWin32_CreateWindow(ImGuiViewport* viewport) ImGuiViewportDataWin32* data = IM_NEW(ImGuiViewportDataWin32)(); viewport->PlatformUserData = data; - ImGuiIO& io = ImGui::GetIO(); bool no_decoration = (viewport->Flags & ImGuiViewportFlags_NoDecoration) != 0; - bool no_task_bar = (io.ConfigFlags & ImGuiConfigFlags_NoTaskBarForViewports) != 0; + bool no_task_bar_icon = (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon) != 0; if (no_decoration) { data->DwStyle = WS_POPUP; - data->DwExStyle = no_task_bar ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; + data->DwExStyle = no_task_bar_icon ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; } else { data->DwStyle = WS_OVERLAPPEDWINDOW; - data->DwExStyle = no_task_bar ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; + data->DwExStyle = no_task_bar_icon ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; } // Create window diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp index ac4db3a5..991a4d40 100644 --- a/examples/opengl2_example/main.cpp +++ b/examples/opengl2_example/main.cpp @@ -31,7 +31,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls ImGui_ImplGlfw_InitForOpenGL(window, true); ImGui_ImplOpenGL2_Init(); diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index b9170c9e..485bca12 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -36,7 +36,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp index 366bc222..37081b66 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/sdl_opengl3_example/main.cpp @@ -38,7 +38,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls ImGui_ImplSDL2_Init(window, gl_context); diff --git a/examples/sdl_vulkan_example/main.cpp b/examples/sdl_vulkan_example/main.cpp index 53de0fbb..3c128d47 100644 --- a/examples/sdl_vulkan_example/main.cpp +++ b/examples/sdl_vulkan_example/main.cpp @@ -335,7 +335,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup SDL binding diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp index 4ff79e6d..bc1eb5d7 100644 --- a/examples/vulkan_example/main.cpp +++ b/examples/vulkan_example/main.cpp @@ -347,7 +347,7 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_EnableViewports; - io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarForViewports; + io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup GLFW binding diff --git a/imgui.cpp b/imgui.cpp index 3cfb3425..d39976b5 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3549,6 +3549,13 @@ void ImGui::UpdatePlatformWindows() continue; } + // Update ImGuiViewportFlags_NoTaskBarIcon flag + if (viewport->Window != NULL) + { + bool no_task_bar_icon = (g.IO.ConfigFlags & ImGuiConfigFlags_NoTaskBarIconsForViewports) != 0 || (viewport->Window->Flags & (ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) != 0; + viewport->Flags = no_task_bar_icon ? (viewport->Flags | ImGuiViewportFlags_NoTaskBarIcon) : (viewport->Flags & ~ImGuiViewportFlags_NoTaskBarIcon); + } + bool is_new_window = (viewport->PlatformHandle == NULL && viewport->PlatformUserData == NULL && viewport->RendererUserData == NULL); if (is_new_window && viewport->PlatformHandle == NULL && viewport->PlatformUserData == NULL) g.PlatformIO.Platform_CreateWindow(viewport); diff --git a/imgui.h b/imgui.h index ef3abe8b..bf010d7c 100644 --- a/imgui.h +++ b/imgui.h @@ -798,10 +798,10 @@ enum ImGuiConfigFlags_ ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility. // [BETA] Viewports - ImGuiConfigFlags_EnableViewports = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends) - ImGuiConfigFlags_EnableDpiScaleViewports= 1 << 11, - ImGuiConfigFlags_EnableDpiScaleFonts = 1 << 12, - ImGuiConfigFlags_NoTaskBarForViewports = 1 << 13, + ImGuiConfigFlags_EnableViewports = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends) + ImGuiConfigFlags_EnableDpiScaleViewports = 1 << 11, + ImGuiConfigFlags_EnableDpiScaleFonts = 1 << 12, + ImGuiConfigFlags_NoTaskBarIconsForViewports = 1 << 13, // User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui) ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware. @@ -1924,7 +1924,8 @@ enum ImGuiViewportFlags_ ImGuiViewportFlags_NoDecoration = 1 << 0, // Platform Window: Disable platform title bar, borders, etc. ImGuiViewportFlags_NoFocusOnAppearing = 1 << 1, // Platform Window: Don't take focus when created. ImGuiViewportFlags_NoInputs = 1 << 2, // Platform Window: Make mouse pass through so we can drag this window while peaking behind it. - ImGuiViewportFlags_NoRendererClear = 1 << 3 // Platform Window: Renderer doesn't need to clear the framebuffer ahead. + ImGuiViewportFlags_NoTaskBarIcon = 1 << 3, // Platform Window: Disable platform task bar icon (for popups, menus, or all windows if ImGuiConfigFlags_NoTaskBarIconsForViewports if set) + ImGuiViewportFlags_NoRendererClear = 1 << 4 // Platform Window: Renderer doesn't need to clear the framebuffer ahead. }; // The viewports created and managed by imgui. The role of the platform back-end is to create the platform/OS windows corresponding to each viewport.