Detect HTHSCROLL/HTVSCROLL as HTCLIENT in WM_NCHITTEST message

In this way we fix a bug where (sometimes) the mouse is not detected
as in the client area because it's over a system scrollbar.
This commit is contained in:
David Capello 2014-05-05 21:37:20 -03:00
parent 6aca409d84
commit 81d30fb24d

View File

@ -394,6 +394,19 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
break;
}
case WM_NCHITTEST: {
LRESULT result = ::CallWindowProc(base_wndproc, hwnd, msg, wparam, lparam);
// We ignore scrollbars so if the mouse is above them, we return
// as it's in the client area. (Remember that we have scroll
// bars are enabled and visible to receive trackpad messages
// only.)
if (result == HTHSCROLL || result == HTVSCROLL)
result = HTCLIENT;
return result;
}
}
return ::CallWindowProc(base_wndproc, hwnd, msg, wparam, lparam);
}