Skip to content

Commit 1ab1e3c

Browse files
RT2Codeocornut
authored andcommitted
Backends: SDL3: rework implementation of ImGuiViewportFlags_NoTaskBarIcon. (#7989)
1 parent 8ba7efb commit 1ab1e3c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

backends/imgui_impl_sdl3.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,7 @@ static void ImGui_ImplSDL3_CreateWindow(ImGuiViewport* viewport)
951951
sdl_flags |= SDL_GetWindowFlags(bd->Window);
952952
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoDecoration) ? SDL_WINDOW_BORDERLESS : 0;
953953
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoDecoration) ? 0 : SDL_WINDOW_RESIZABLE;
954-
#if !defined(_WIN32)
955-
// See SDL hack in ImGui_ImplSDL3_ShowWindow().
956954
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon) ? SDL_WINDOW_UTILITY : 0;
957-
#endif
958955
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_TopMost) ? SDL_WINDOW_ALWAYS_ON_TOP : 0;
959956
vd->Window = SDL_CreateWindow("No Title Yet", (int)viewport->Size.x, (int)viewport->Size.y, sdl_flags);
960957
SDL_SetWindowParent(vd->Window, vd->ParentWindow);
@@ -992,13 +989,14 @@ static void ImGui_ImplSDL3_ShowWindow(ImGuiViewport* viewport)
992989
#if defined(_WIN32)
993990
HWND hwnd = (HWND)viewport->PlatformHandleRaw;
994991

995-
// SDL hack: Hide icon from task bar
996-
// Note: SDL 3.0.0+ has a SDL_WINDOW_UTILITY flag which is supported under Windows but the way it create the window breaks our seamless transition.
997-
if (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon)
992+
// SDL hack: Show icon in task bar (#7989)
993+
// Note: SDL_WINDOW_UTILITY can be used to control task bar visibility, but on Windows, it does not affect child windows.
994+
if (!(viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon))
998995
{
999996
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
1000-
ex_style &= ~WS_EX_APPWINDOW;
1001-
ex_style |= WS_EX_TOOLWINDOW;
997+
ex_style |= WS_EX_APPWINDOW;
998+
ex_style &= ~WS_EX_TOOLWINDOW;
999+
::ShowWindow(hwnd, SW_HIDE);
10021000
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
10031001
}
10041002
#endif

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Docking+Viewports Branch:
8686
mouse tracking and temporary lead to incorrect update of HoveredWindow. (#7971)
8787
- Backends: SDL3: added support for viewport->ParentViewportId field to support parenting
8888
windows at OS level. (#7973) [@RT2code]
89+
- Backends: SDL3: rework implementation of _NoTaskBarIcon. (#7989) [@RT2code]
8990

9091
-----------------------------------------------------------------------
9192
VERSION 1.91.1 (Released 2024-09-04)

0 commit comments

Comments
 (0)