Skip to content

Commit

Permalink
Backends: SDL3: rework implementation of ImGuiViewportFlags_NoTaskBar…
Browse files Browse the repository at this point in the history
…Icon. (ocornut#7989)
  • Loading branch information
RT2Code authored and ocornut committed Sep 17, 2024
1 parent 8ba7efb commit 1ab1e3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 6 additions & 8 deletions backends/imgui_impl_sdl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,7 @@ static void ImGui_ImplSDL3_CreateWindow(ImGuiViewport* viewport)
sdl_flags |= SDL_GetWindowFlags(bd->Window);
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoDecoration) ? SDL_WINDOW_BORDERLESS : 0;
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoDecoration) ? 0 : SDL_WINDOW_RESIZABLE;
#if !defined(_WIN32)
// See SDL hack in ImGui_ImplSDL3_ShowWindow().
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon) ? SDL_WINDOW_UTILITY : 0;
#endif
sdl_flags |= (viewport->Flags & ImGuiViewportFlags_TopMost) ? SDL_WINDOW_ALWAYS_ON_TOP : 0;
vd->Window = SDL_CreateWindow("No Title Yet", (int)viewport->Size.x, (int)viewport->Size.y, sdl_flags);
SDL_SetWindowParent(vd->Window, vd->ParentWindow);
Expand Down Expand Up @@ -992,13 +989,14 @@ static void ImGui_ImplSDL3_ShowWindow(ImGuiViewport* viewport)
#if defined(_WIN32)
HWND hwnd = (HWND)viewport->PlatformHandleRaw;

// SDL hack: Hide icon from task bar
// 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.
if (viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon)
// SDL hack: Show icon in task bar (#7989)
// Note: SDL_WINDOW_UTILITY can be used to control task bar visibility, but on Windows, it does not affect child windows.
if (!(viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon))
{
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
ex_style &= ~WS_EX_APPWINDOW;
ex_style |= WS_EX_TOOLWINDOW;
ex_style |= WS_EX_APPWINDOW;
ex_style &= ~WS_EX_TOOLWINDOW;
::ShowWindow(hwnd, SW_HIDE);
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
}
#endif
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Docking+Viewports Branch:
mouse tracking and temporary lead to incorrect update of HoveredWindow. (#7971)
- Backends: SDL3: added support for viewport->ParentViewportId field to support parenting
windows at OS level. (#7973) [@RT2code]
- Backends: SDL3: rework implementation of _NoTaskBarIcon. (#7989) [@RT2code]

-----------------------------------------------------------------------
VERSION 1.91.1 (Released 2024-09-04)
Expand Down

0 comments on commit 1ab1e3c

Please sign in to comment.