-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Description
Version/Branch of Dear ImGui:
Version: v1.89WIP
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_sdl.cpp + imgui_impl_metal.mm
Compiler: clang
Operating System: iOS
My Issue/Question:
When compiling the docking branch for iOS, I get the following compilation errors:
imgui_impl_sdl.cpp:418:61: No member named 'cocoa' in 'SDL_SysWMinfo::(unnamed union at sdl2/SDL_syswm.h:230:5)'
imgui_impl_sdl.cpp:764:56: No member named 'cocoa' in 'SDL_SysWMinfo::(unnamed union at sdl2/SDL_syswm.h:230:5)'
The corresponding code looks like this:
#if defined(_WIN32)
viewport->PlatformHandleRaw = info.info.win.window;
#elif defined(__APPLE__)
viewport->PlatformHandleRaw = (void*)info.info.cocoa.window;
#endif
This is incorrect on iOS since SDL doesn't use the COCOA video driver on iOS (it uses UIKit). The following code would work but would not cover cases other than Windows, macOS and iOS:
#ifdef _WIN32
viewport->PlatformHandleRaw = (void*)info.info.win.window;
#elif defined(SDL_VIDEO_DRIVER_COCOA)
viewport->PlatformHandleRaw = (void*)info.info.cocoa.window;
#elif defined(SDL_VIDEO_DRIVER_UIKIT)
viewport->PlatformHandleRaw = (void*)info.info.uikit.window;
#endif
It seems the issue is a result of the following commit: 9ff3017 (see #5392)
On the master branch this is no issue since the corresponding code isn't there. I think the correct solution would be to cover all cases that SDL covers. However, I'm not sure if this is what you want, @ocornut.
Regards,
Thomas