Skip to content

Commit

Permalink
ImGui_ImplSDL2_WaitForEvent needs SDLWindow* param
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Mar 25, 2022
1 parent ea416c8 commit 338fdf3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backends/imgui_impl_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ static void ImGui_ImplSDL2_UpdateKeyModifiers(SDL_Keymod sdl_key_mods)
io.AddKeyEvent(ImGuiKey_ModSuper, (sdl_key_mods & KMOD_GUI) != 0);
}

void ImGui_ImplSDL2_WaitForEvent()
void ImGui_ImplSDL2_WaitForEvent(SDL_Window* window)
{
if (!(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnablePowerSavingMode))
return;

Uint32 window_flags = SDL_GetWindowFlags(g_Window);
Uint32 window_flags = SDL_GetWindowFlags(window);
bool window_is_hidden = window_flags & (SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
double waiting_time = window_is_hidden ? INFINITY : ImGui::GetEventWaitingTime();
if (waiting_time > 0.0)
Expand Down
2 changes: 1 addition & 1 deletion backends/imgui_impl_sdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window, SDL_Renderer* renderer);
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
IMGUI_IMPL_API void ImGui_ImplSDL2_WaitForEvent();
IMGUI_IMPL_API void ImGui_ImplSDL2_WaitForEvent(SDL_Window* window);
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);

#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
Expand Down
2 changes: 1 addition & 1 deletion examples/example_sdl_opengl3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int, char**)
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
ImGui_ImplSDL2_WaitForEvent();
ImGui_ImplSDL2_WaitForEvent(window);
SDL_Event event;
while (SDL_PollEvent(&event))
{
Expand Down

0 comments on commit 338fdf3

Please sign in to comment.