Backends: Win32: Facepalm revert part of d15574c + additional commentary (#6275)

This commit is contained in:
ocornut 2024-05-07 17:03:05 +02:00
parent d15574ce2a
commit 1ab1af80c7
2 changed files with 4 additions and 7 deletions

View file

@ -21,7 +21,6 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2024-05-07: Removed silent return when calling ImGui_ImplWin32_WndProcHandler() with no active context! If you don't always have an active context, check that ImGui::GetCurrentContext() != nullptr before calling this.
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
// 2023-09-25: Inputs: Synthesize key-down event on key-up for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows doesn't emit it (same behavior as GLFW/SDL).
// 2023-09-07: Inputs: Added support for keyboard codepage conversion for when application is compiled in MBCS mode and using a non-Unicode window.
@ -581,9 +580,10 @@ static ImGuiMouseSource GetMouseSourceFromMessageExtraInfo()
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Before 2024-05-07 we were silently returning if ImGui::GetCurrentContext() == nullptr,
// which was inconsistent with other backends. Make sure you call this after initializing the imgui context,
// other add an 'if (ImGui::GetCurrentContext() != NULL)` check before calling ImGui_ImplWin32_WndProcHandler().
// Most backends don't have silent checks like this one, but we need it because WndProc are called early in CreateWindow().
if (ImGui::GetCurrentContext() == nullptr)
return 0;
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplWin32_Init()?");
ImGuiIO& io = ImGui::GetIO();

View file

@ -78,9 +78,6 @@ Other changes:
negative fraction, e.g. ProgressBar(-1.0f * GetTime()). (#5316, #5370, #1901)[@gan74]
- Text, DrawList: Improved handling of long single-line wrapped text. Faster and
mitigitate issues with reading vertex indexing limits with 16-bit indices. (#7496, #5720)
- Backends: Win32: Removed silent return when calling ImGui_ImplWin32_WndProcHandler() with
no active context! If you don't always have an active context, you can check that
ImGui::GetCurrentContext() != nullptr before calling ImGui_ImplWin32_WndProcHandler(). (#6275)
- Backends: OpenGL3: Detect ES3 contexts on desktop based on version string,
to e.g. avoid calling glPolygonMode() on them. (#7447) [@afraidofdark, @ocornut]
- Backends: Vulkan: Added convenience support for Volk via IMGUI_IMPL_VULKAN_USE_VOLK define.