mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Win32: Return HTCLIENT when the mouse is above scrollbars but inside the client area
This commit is contained in:
parent
0d2b3d1d68
commit
0f99c78174
@ -325,15 +325,25 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
|
||||
case WM_NCHITTEST: {
|
||||
LRESULT result = ::CallWindowProc(base_wndproc, hwnd, msg, wparam, lparam);
|
||||
gfx::Point pt(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
|
||||
RECT rc;
|
||||
::GetClientRect(hwnd, &rc);
|
||||
::MapWindowPoints(hwnd, NULL, (POINT*)&rc, 2);
|
||||
gfx::Rect area(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
|
||||
|
||||
//PRINTF("NCHITTEST: %d %d - %d %d %d %d - %s\n", pt.x, pt.y, area.x, area.y, area.w, area.h, area.contains(pt) ? "true": "false");
|
||||
|
||||
// We ignore scrollbars so if the mouse is above them, we return
|
||||
// as it's in the window resize area. (Remember that we have
|
||||
// scroll bars are enabled and visible to receive trackpad
|
||||
// messages only.)
|
||||
if (result == HTHSCROLL)
|
||||
result = HTBOTTOM;
|
||||
else if (result == HTVSCROLL)
|
||||
result = HTRIGHT;
|
||||
// as it's in the window client or resize area. (Remember that
|
||||
// we have scroll bars are enabled and visible to receive
|
||||
// trackpad messages only.)
|
||||
if (result == HTHSCROLL) {
|
||||
result = (area.contains(pt) ? HTCLIENT: HTBOTTOM);
|
||||
}
|
||||
else if (result == HTVSCROLL) {
|
||||
result = (area.contains(pt) ? HTCLIENT: HTRIGHT);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user