Browse Source

Examples: SDL: Fix for Emscripten/Android/iOS on Docking branch.

omar 6 years ago
parent
commit
f6fbb99a9c
1 changed files with 1 additions and 3 deletions
  1. 1 3
      examples/imgui_impl_sdl.cpp

+ 1 - 3
examples/imgui_impl_sdl.cpp

@@ -269,13 +269,12 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
     io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
     io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
     g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
     g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
 
 
-#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
+#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
 
 
     // SDL 2.0.4 and later has SDL_GetGlobalMouseState() and SDL_CaptureMouse()
     // SDL 2.0.4 and later has SDL_GetGlobalMouseState() and SDL_CaptureMouse()
     int mouse_x_global, mouse_y_global;
     int mouse_x_global, mouse_y_global;
     SDL_GetGlobalMouseState(&mouse_x_global, &mouse_y_global);
     SDL_GetGlobalMouseState(&mouse_x_global, &mouse_y_global);
 
 
-#if !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
     if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
     if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
     {
     {
         // Multi-viewport mode: mouse position in OS absolute coordinates (io.MousePos is (0,0) when the mouse is on the upper-left of the primary monitor)
         // Multi-viewport mode: mouse position in OS absolute coordinates (io.MousePos is (0,0) when the mouse is on the upper-left of the primary monitor)
@@ -284,7 +283,6 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
                 io.MousePos = ImVec2((float)mouse_x_global, (float)mouse_y_global);
                 io.MousePos = ImVec2((float)mouse_x_global, (float)mouse_y_global);
     }
     }
     else
     else
-#endif
     {
     {
         // Single-viewport mode: mouse position in client window coordinatesio.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
         // Single-viewport mode: mouse position in client window coordinatesio.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
         if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
         if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)