张洋 3 weeks ago
parent
commit
dbee0e2d93
1 changed files with 20 additions and 5 deletions
  1. 20 5
      DuiLib/Core/UIBase.cpp

+ 20 - 5
DuiLib/Core/UIBase.cpp

@@ -320,8 +320,12 @@ UINT CWindowWnd::ShowModal()
     ::SetForegroundWindow(m_hWnd);
     ::SetActiveWindow(m_hWnd);
     ::SetFocus(m_hWnd);
-    DuiLib::TouchTrace::Log(_T("MODAL-ENTER hwnd=%p owner=%p parent=%p foreground=%p active=%p focus=%p enabled=%d visible=%d style=0x%08X ex=0x%08X"),
-        (void*)m_hWnd, (void*)hWndParent, (void*)::GetParent(m_hWnd), (void*)::GetForegroundWindow(), (void*)::GetActiveWindow(), (void*)::GetFocus(),
+    RECT rcModal = { 0 };
+    ::GetWindowRect(m_hWnd, &rcModal);
+    DuiLib::TouchTrace::Log(_T("MODAL-ENTER hwnd=%p owner=%p parent=%p rect=%d,%d,%d,%d foreground=%p active=%p focus=%p enabled=%d visible=%d style=0x%08X ex=0x%08X"),
+        (void*)m_hWnd, (void*)hWndParent, (void*)::GetParent(m_hWnd),
+        (int)rcModal.left, (int)rcModal.top, (int)rcModal.right, (int)rcModal.bottom,
+        (void*)::GetForegroundWindow(), (void*)::GetActiveWindow(), (void*)::GetFocus(),
         (int)::IsWindowEnabled(m_hWnd), (int)::IsWindowVisible(m_hWnd),
         (unsigned)::GetWindowLong(m_hWnd, GWL_STYLE), (unsigned)::GetWindowLong(m_hWnd, GWL_EXSTYLE));
     ::EnableWindow(hWndParent, FALSE);
@@ -529,11 +533,22 @@ LRESULT CALLBACK CWindowWnd::__WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
             return lRes;
         }
     }
-    // 临时诊断:确认 WM_TOUCH 是否真的被 Windows 投递到本窗口过程
-    // (用于区分「Windows 没投递」与「我们的消息链丢了」,定位完删除)
+    // 临时诊断(Route A):确认 WM_TOUCH 是否真被投递,并读出触点屏幕坐标,
+    // 用于判断「手指点在弹框上」时 WM_TOUCH 是否落到了 owner(主窗口)。
+    // ⚠️ 只 peek,绝不调用 CloseTouchInputHandle —— 句柄必须交给 DuiLib 的
+    // OnTouchInput 去关闭,否则主窗口触摸会断。
     if( uMsg == WM_TOUCH ) {
-        DuiLib::TouchTrace::Log(_T("WNDPROC-TOUCH hwnd=%p pThis=%p owner=%p parent=%p extra=0x%08X style=0x%08X ex=0x%08X"),
+        UINT cInputs = (UINT)(ULONG_PTR)wParam;
+        HTOUCHINPUT hTouch = (HTOUCHINPUT)lParam;
+        int tx = 0, ty = 0;
+        TOUCHINPUT ti = { 0 };
+        if( cInputs > 0 && ::GetTouchInputInfo(hTouch, 1, &ti, sizeof(TOUCHINPUT)) ) {
+            tx = (int)(ti.x / 100);   // 原始坐标为 1/100 像素,转近似屏幕像素
+            ty = (int)(ti.y / 100);
+        }
+        DuiLib::TouchTrace::Log(_T("WNDPROC-TOUCH hwnd=%p pThis=%p owner=%p parent=%p tx=%d ty=%d inputs=%u extra=0x%08X style=0x%08X ex=0x%08X"),
             (void*)hWnd, (void*)pThis, (void*)::GetWindow(hWnd, GW_OWNER), (void*)::GetParent(hWnd),
+            tx, ty, cInputs,
             (unsigned)(DWORD_PTR)::GetMessageExtraInfo(),
             (unsigned)::GetWindowLong(hWnd, GWL_STYLE), (unsigned)::GetWindowLong(hWnd, GWL_EXSTYLE));
     }