Skip to content

Commit

Permalink
ImGui_ImplWin32_WaitForEvent: add hwnd param
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Mar 25, 2022
1 parent 338fdf3 commit ce41ede
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_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,12 @@ static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
}
}

void ImGui_ImplWin32_WaitForEvent()
void ImGui_ImplWin32_WaitForEvent(void* hwnd)
{
if (!(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnablePowerSavingMode))
return;

BOOL window_is_hidden = !IsWindowVisible(g_hWnd) || IsIconic(g_hWnd);
BOOL window_is_hidden = !IsWindowVisible((HWND)hwnd) || IsIconic((HWND)hwnd);
double waiting_time = window_is_hidden ? INFINITE : ImGui::GetEventWaitingTime();
if (waiting_time > 0.0)
{
Expand Down
2 changes: 1 addition & 1 deletion backends/imgui_impl_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
IMGUI_IMPL_API void ImGui_ImplWin32_WaitForEvent();
IMGUI_IMPL_API void ImGui_ImplWin32_WaitForEvent(void* hwnd);

// Win32 message handler your application need to call.
// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.
Expand Down
2 changes: 1 addition & 1 deletion examples/example_win32_directx11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int main(int, char**)
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
ImGui_ImplWin32_WaitForEvent();
ImGui_ImplWin32_WaitForEvent(hwnd);
while (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
::TranslateMessage(&msg);
Expand Down

0 comments on commit ce41ede

Please sign in to comment.