Version/Branch of Dear ImGui:
Version 1.91.8, Branch: docking
Back-ends:
imgui_impl_sdl3.cpp + own gpu rendering backend
Compiler, OS:
AppleClang 17.0
Full config/build information:
Dear ImGui 1.91.8 (19180)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202002
define: __APPLE__
define: __GNUC__=4
define: __clang_version__=17.0.0 (clang-1700.0.13.3)
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl3
io.BackendRendererName: imgui_impl_mtls_gpu
io.ConfigFlags: 0x00000481
NavEnableKeyboard
DockingEnable
ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigDockingTransparentPayload
io.ConfigMacOSXBehaviors
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
RendererHasVtxOffset
RendererHasViewports
--------------------------------
io.Fonts: 10 fonts, Flags: 0x00000000, TexSize: 4096,4096
io.DisplaySize: 1512.00,833.00
io.DisplayFramebufferScale: 2.00,2.00
--------------------------------
style.WindowPadding: 0.00,0.00
style.WindowBorderSize: 0.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
SDL3 no longer exposes its build configuration defines (like SDL_VIDEO_DRIVER_COCOA) in their public headers (through the cmake SDL3::Headers target), and the build_config headers are now only available as private scoped headers in SDL3.
This causes SDL_VIDEO_DRIVER_COCOA to be no longer defined, and assigning to PlatformHandleRaw to not happen, leading to a missing PlatformHandleRaw pointer downstream:
static void ImGui_ImplSDL3_SetupPlatformHandles(ImGuiViewport* viewport, SDL_Window* window)
{
viewport->PlatformHandle = (void*)(intptr_t)SDL_GetWindowID(window);
viewport->PlatformHandleRaw = nullptr;
#if defined(_WIN32) && !defined(__WINRT__)
viewport->PlatformHandleRaw = (HWND)SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr);
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
viewport->PlatformHandleRaw = SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, nullptr);
#endif
}
As far as I can tell, SDL_GetCurrentVideoDriver is supposed to be used now to get the currently used videodriver from SDL.
This function is available since SDL 3.2.0 (which is the first non-preview SDL3 release, so that should be ok?). Something like so:
static void ImGui_ImplSDL3_SetupPlatformHandles(ImGuiViewport* viewport, SDL_Window* window)
{
viewport->PlatformHandle = (void*)(intptr_t)SDL_GetWindowID(window);
viewport->PlatformHandleRaw = nullptr;
#if defined(_WIN32) && !defined(__WINRT__)
viewport->PlatformHandleRaw = (HWND)SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr);
#elif defined(__APPLE__)
const char* sdl_backend = SDL_GetCurrentVideoDriver();
constexpr const char cocoa_backend[] = "cocoa";
// -1 because of 0-terminator is counted in compile-time sizeof, where run-time strlen doesn't count the 0-terminator
if (strncmp(sdl_backend, cocoa_backend, sizeof(cocoa_backend) - 1) == 0) {
viewport->PlatformHandleRaw = SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, nullptr);
}
#endif
}
In SDL2 the SDL_config.h (which in turn includes the platform specific SDL_config_xxx.h) include came indirectly by include SDL.h (which includes SDL_cstdinc.h, which includes SDL_config.h).
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Version/Branch of Dear ImGui:
Version 1.91.8, Branch: docking
Back-ends:
imgui_impl_sdl3.cpp + own gpu rendering backend
Compiler, OS:
AppleClang 17.0
Full config/build information:
Details:
SDL3 no longer exposes its build configuration defines (like SDL_VIDEO_DRIVER_COCOA) in their public headers (through the cmake SDL3::Headers target), and the build_config headers are now only available as private scoped headers in SDL3.
This causes SDL_VIDEO_DRIVER_COCOA to be no longer defined, and assigning to PlatformHandleRaw to not happen, leading to a missing PlatformHandleRaw pointer downstream:
As far as I can tell, SDL_GetCurrentVideoDriver is supposed to be used now to get the currently used videodriver from SDL.
This function is available since SDL 3.2.0 (which is the first non-preview SDL3 release, so that should be ok?). Something like so:
In SDL2 the SDL_config.h (which in turn includes the platform specific SDL_config_xxx.h) include came indirectly by include SDL.h (which includes SDL_cstdinc.h, which includes SDL_config.h).
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code: