From 6461fd40ab815e14358923d4ffabbb8c40d8d049 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 7 Sep 2020 12:19:50 +0200 Subject: [PATCH] Examples: Fixed SDL+OpenGL2 and SDL+Vulkan examples not processing SDL_WINDOWEVENT_CLOSE events which tends to be needed in multi-viewport setting. --- examples/example_sdl_opengl2/main.cpp | 2 ++ examples/example_sdl_vulkan/main.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp index fcd9ae32..34ea80d0 100644 --- a/examples/example_sdl_opengl2/main.cpp +++ b/examples/example_sdl_opengl2/main.cpp @@ -87,6 +87,8 @@ int main(int, char**) ImGui_ImplSDL2_ProcessEvent(&event); if (event.type == SDL_QUIT) done = true; + if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) + done = true; } // Start the Dear ImGui frame diff --git a/examples/example_sdl_vulkan/main.cpp b/examples/example_sdl_vulkan/main.cpp index 03d7ded3..c6ce12a1 100644 --- a/examples/example_sdl_vulkan/main.cpp +++ b/examples/example_sdl_vulkan/main.cpp @@ -454,6 +454,8 @@ int main(int, char**) ImGui_ImplSDL2_ProcessEvent(&event); if (event.type == SDL_QUIT) done = true; + if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) + done = true; } // Resize swap chain?