Backends: GLFW: Fixed not installing WndProc hook in all GLFW version, so AddMouseSourceEvent() logic was missing for some viewports.

This commit is contained in:
ocornut
2025-06-21 20:10:18 +02:00
parent e132b444a9
commit efe2b21a5f
2 changed files with 4 additions and 3 deletions

View File

@@ -1284,12 +1284,10 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
}
// GLFW hack: install hook for WM_NCHITTEST message handler
#if !GLFW_HAS_MOUSE_PASSTHROUGH && GLFW_HAS_WINDOW_HOVERED && defined(_WIN32)
// GLFW hack: install WndProc for mouse source event and WM_NCHITTEST message handler.
::SetPropA(hwnd, "IMGUI_VIEWPORT", viewport);
vd->PrevWndProc = (WNDPROC)::GetWindowLongPtrW(hwnd, GWLP_WNDPROC);
::SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
#endif
#if !GLFW_HAS_FOCUS_ON_SHOW
// GLFW hack: GLFW 3.2 has a bug where glfwShowWindow() also activates/focus the window.

View File

@@ -469,6 +469,9 @@ Docking+Viewports Branch:
- Backends: SDL3: macOS: Fixed secondary-viewports not appearing on a different
monitor than the main viewport. Because SDL_SetWindowParent() seems to restrict it.
- Backends: GLFW: Disable multi-viewports under Wayland (require GLFW 3.4). (#8587)
- Backends: GLFW: Fixed an issue where Win32 specific WndProc hook was not installed
for all GLFW version, preventing mouse vs touch detection from working on
secondary viewports.
-----------------------------------------------------------------------