From caf4b7f1e6190ec4b32c66aca3e94a9ef15c0378 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 9 Sep 2022 16:45:16 +0200 Subject: [PATCH] Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (#5665) --- backends/imgui_impl_sdl.cpp | 6 ++++-- docs/CHANGELOG.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_sdl.cpp b/backends/imgui_impl_sdl.cpp index 0ead88cf4..e375c3a43 100644 --- a/backends/imgui_impl_sdl.cpp +++ b/backends/imgui_impl_sdl.cpp @@ -408,13 +408,14 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer, void // Our mouse update function expect PlatformHandle to be filled for the main viewport ImGuiViewport* main_viewport = ImGui::GetMainViewport(); main_viewport->PlatformHandle = (void*)window; + main_viewport->PlatformHandleRaw = NULL; SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWindowWMInfo(window, &info)) { #ifdef _WIN32 main_viewport->PlatformHandleRaw = (void*)info.info.win.window; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) main_viewport->PlatformHandleRaw = (void*)info.info.cocoa.window; #endif } @@ -754,13 +755,14 @@ static void ImGui_ImplSDL2_CreateWindow(ImGuiViewport* viewport) SDL_GL_MakeCurrent(vd->Window, backup_context); viewport->PlatformHandle = (void*)vd->Window; + viewport->PlatformHandleRaw = NULL; SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWindowWMInfo(vd->Window, &info)) { #if defined(_WIN32) viewport->PlatformHandleRaw = info.info.win.window; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) viewport->PlatformHandleRaw = (void*)info.info.cocoa.window; #endif } diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 732c705fe..9db0ecfad 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -192,6 +192,7 @@ Docking+Viewports Branch: - Docking: Fixed amending into an existing tab bar from rendering invisible items. (#5515) - Docking+Viewports: Fixed undocking window node causing parent viewports to become unresponsive in certain situation (e.g. hidden tab bar). (#5503) [@rokups] +- Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (#5665) - Backends: GLFW: Fixed leftover static variable preventing from changing or reinitializing backend while application is running. (#4616, #5434) [@rtoumazet]