Fixed warnings.

This commit is contained in:
omar 2018-03-07 14:46:53 +01:00
parent 9dcc07422e
commit d8719cf59b
2 changed files with 7 additions and 13 deletions

View File

@ -27,7 +27,6 @@
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_sdl2.h" #include "imgui_impl_sdl2.h"
#include "imgui_internal.h" // FIXME-PLATFORM #include "imgui_internal.h" // FIXME-PLATFORM
// SDL // SDL
@ -149,11 +148,14 @@ bool ImGui_ImplSDL2_Init(SDL_Window* window, void* sdl_gl_context)
// Our mouse update function expect PlatformHandle to be filled for the main viewport // Our mouse update function expect PlatformHandle to be filled for the main viewport
ImGuiViewport* main_viewport = ImGui::GetMainViewport(); ImGuiViewport* main_viewport = ImGui::GetMainViewport();
main_viewport->PlatformHandle = (void*)window; main_viewport->PlatformHandle = (void*)window;
// We need SDL_CaptureMouse(), SDL_GetGlobalMouseState() from SDL 2.0.4+ to support multiple viewports.
// We left the call to ImGui_ImplSDL2_InitPlatformInterface() outside of #ifdef to avoid unused-function warnings.
#if SDL_VERSION_ATLEAST(2,0,4) #if SDL_VERSION_ATLEAST(2,0,4)
io.ConfigFlags |= ImGuiConfigFlags_PlatformHasViewports; io.ConfigFlags |= ImGuiConfigFlags_PlatformHasViewports;
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
ImGui_ImplSDL2_InitPlatformInterface(window, sdl_gl_context);
#endif #endif
if ((io.ConfigFlags & ImGuiConfigFlags_EnableViewports) && (io.ConfigFlags & ImGuiConfigFlags_PlatformHasViewports))
ImGui_ImplSDL2_InitPlatformInterface(window, sdl_gl_context);
return true; return true;
} }
@ -252,9 +254,7 @@ void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
// Platform Windows // Platform Windows
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
#include "imgui_internal.h" #define SDL_HAS_WINDOW_OPACITY SDL_VERSION_ATLEAST(2,0,5)
#define SDL_HAS_WINDOW_OPACITY SDL_VERSION_ATLEAST(2,0,5)
struct ImGuiPlatformDataSDL2 struct ImGuiPlatformDataSDL2
{ {
@ -331,8 +331,8 @@ static void ImGui_ImplSDL2_ShowWindow(ImGuiViewport* viewport)
return; return;
} }
} }
#endif #endif
SDL_ShowWindow(data->Window); SDL_ShowWindow(data->Window);
} }

View File

@ -5194,12 +5194,6 @@ ImVec2 ImGui::GetItemRectSize()
return window->DC.LastItemRect.GetSize(); return window->DC.LastItemRect.GetSize();
} }
static ImRect GetViewportRect()
{
ImGuiContext& g = *GImGui;
return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);
}
// Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first. // Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first.
void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip) void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip)
{ {