|
@@ -923,8 +923,11 @@ struct ImGui_ImplGlfw_ViewportData
|
|
|
bool WindowOwned;
|
|
|
int IgnoreWindowPosEventFrame;
|
|
|
int IgnoreWindowSizeEventFrame;
|
|
|
+#ifdef _WIN32
|
|
|
+ WNDPROC PrevWndProc;
|
|
|
+#endif
|
|
|
|
|
|
- ImGui_ImplGlfw_ViewportData() { Window = nullptr; WindowOwned = false; IgnoreWindowSizeEventFrame = IgnoreWindowPosEventFrame = -1; }
|
|
|
+ ImGui_ImplGlfw_ViewportData() { memset(this, 0, sizeof(*this)); IgnoreWindowSizeEventFrame = IgnoreWindowPosEventFrame = -1; }
|
|
|
~ImGui_ImplGlfw_ViewportData() { IM_ASSERT(Window == nullptr); }
|
|
|
};
|
|
|
|
|
@@ -1059,9 +1062,8 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
|
|
|
|
|
|
// GLFW hack: install hook for WM_NCHITTEST message handler
|
|
|
#if !GLFW_HAS_MOUSE_PASSTHROUGH && GLFW_HAS_WINDOW_HOVERED && defined(_WIN32)
|
|
|
- ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
|
|
::SetPropA(hwnd, "IMGUI_VIEWPORT", viewport);
|
|
|
- IM_ASSERT(bd->PrevWndProc == (WNDPROC)::GetWindowLongPtr(hwnd, GWLP_WNDPROC));
|
|
|
+ vd->PrevWndProc = (WNDPROC)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
|
|
::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
|
|
|
#endif
|
|
|
|
|
@@ -1263,6 +1265,12 @@ static ImGuiMouseSource GetMouseSourceFromMessageExtraInfo()
|
|
|
static LRESULT CALLBACK ImGui_ImplGlfw_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
{
|
|
|
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
|
|
+ WNDPROC prev_wndproc = bd->PrevWndProc;
|
|
|
+ ImGuiViewport* viewport = (ImGuiViewport*)::GetPropA(hWnd, "IMGUI_VIEWPORT");
|
|
|
+ if (viewport != NULL)
|
|
|
+ if (ImGui_ImplGlfw_ViewportData* vd = (ImGui_ImplGlfw_ViewportData*)viewport->PlatformUserData)
|
|
|
+ prev_wndproc = vd->PrevWndProc;
|
|
|
+
|
|
|
switch (msg)
|
|
|
{
|
|
|
// GLFW doesn't allow to distinguish Mouse vs TouchScreen vs Pen.
|
|
@@ -1284,14 +1292,13 @@ static LRESULT CALLBACK ImGui_ImplGlfw_WndProc(HWND hWnd, UINT msg, WPARAM wPara
|
|
|
// The ImGuiViewportFlags_NoInputs flag is set while dragging a viewport, as want to detect the window behind the one we are dragging.
|
|
|
// If you cannot easily access those viewport flags from your windowing/event code: you may manually synchronize its state e.g. in
|
|
|
// your main loop after calling UpdatePlatformWindows(). Iterate all viewports/platform windows and pass the flag to your windowing system.
|
|
|
- ImGuiViewport* viewport = (ImGuiViewport*)::GetPropA(hWnd, "IMGUI_VIEWPORT");
|
|
|
if (viewport && (viewport->Flags & ImGuiViewportFlags_NoInputs))
|
|
|
return HTTRANSPARENT;
|
|
|
break;
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
- return ::CallWindowProc(bd->PrevWndProc, hWnd, msg, wParam, lParam);
|
|
|
+ return ::CallWindowProc(prev_wndproc, hWnd, msg, wParam, lParam);
|
|
|
}
|
|
|
#endif // #ifdef _WIN32
|
|
|
|