win32: fix controls in the title bar area can't be hovered

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-05-15 14:29:21 +08:00
parent 3a0e6f081f
commit c2c6ef1976
1 changed files with 5 additions and 4 deletions

View File

@ -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);
}