Browse Source

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

ocornut 2 months ago
parent
commit
efe2b21a5f
2 changed files with 4 additions and 3 deletions
  1. 1 3
      backends/imgui_impl_glfw.cpp
  2. 3 0
      docs/CHANGELOG.txt

+ 1 - 3
backends/imgui_impl_glfw.cpp

@@ -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.

+ 3 - 0
docs/CHANGELOG.txt

@@ -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.
 
 
 -----------------------------------------------------------------------