From c2c6ef1976a3c45451ac71ac04f20f7788667e37 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 15 May 2022 14:29:21 +0800 Subject: [PATCH] win32: fix controls in the title bar area can't be hovered Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- src/core/framelesshelper_win.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 935e781..14c690e 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -192,10 +192,10 @@ FRAMELESSHELPER_STRING_CONSTANT(FindWindowW) return HTCLOSE; } } - // The parent window has quite some logic in the hit test handler, we - // should forward this message to the parent window and return what it - // returns to make sure our homemade title bar is still functional. - return SendMessageW(parentWindowHandle, WM_NCHITTEST, 0, lParam); + // Returns "HTTRANSPARENT" to let the mouse event pass through this invisible + // window to the parent window beneath it, otherwise all the controls under it + // can't be hovered. + return HTTRANSPARENT; } case WM_NCMOUSEMOVE: { // When we get this message, it's because the mouse moved when it was @@ -350,6 +350,7 @@ FRAMELESSHELPER_STRING_CONSTANT(FindWindowW) // receive mouse events from our homemade title bar. if (isMouseEvent) { SendMessageW(parentWindowHandle, uMsg, wParam, lParam); + return 0; // There's nothing to do in this invisible window, so ignore it. } return DefWindowProcW(hWnd, uMsg, wParam, lParam); }