Commit a746e3b7 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Check in client area before caption area, because the app may have

changed the NC area in WM_NCCALCSIZE.
parent 91704df4
...@@ -478,7 +478,8 @@ END: ...@@ -478,7 +478,8 @@ END:
static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt )
{ {
RECT rect; RECT rect, rcClient;
POINT ptClient;
TRACE("hwnd=%p pt=%ld,%ld\n", wndPtr->hwndSelf, pt.x, pt.y ); TRACE("hwnd=%p pt=%ld,%ld\n", wndPtr->hwndSelf, pt.x, pt.y );
...@@ -487,6 +488,12 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) ...@@ -487,6 +488,12 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt )
if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
/* Check client area */
ptClient = pt;
ScreenToClient( wndPtr->hwndSelf, &ptClient );
GetClientRect( wndPtr->hwndSelf, &rcClient );
if (PtInRect( &rcClient, ptClient )) return HTCLIENT;
/* Check borders */ /* Check borders */
if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
{ {
...@@ -571,34 +578,28 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) ...@@ -571,34 +578,28 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt )
} }
} }
/* Check client area */
ScreenToClient( wndPtr->hwndSelf, &pt );
GetClientRect( wndPtr->hwndSelf, &rect );
if (PtInRect( &rect, pt )) return HTCLIENT;
/* Check vertical scroll bar */ /* Check vertical scroll bar */
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
{ {
if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
rect.left -= GetSystemMetrics(SM_CXVSCROLL); rcClient.left -= GetSystemMetrics(SM_CXVSCROLL);
else else
rect.right += GetSystemMetrics(SM_CXVSCROLL); rcClient.right += GetSystemMetrics(SM_CXVSCROLL);
if (PtInRect( &rect, pt )) return HTVSCROLL; if (PtInRect( &rcClient, ptClient )) return HTVSCROLL;
} }
/* Check horizontal scroll bar */ /* Check horizontal scroll bar */
if (wndPtr->dwStyle & WS_HSCROLL) if (wndPtr->dwStyle & WS_HSCROLL)
{ {
rect.bottom += GetSystemMetrics(SM_CYHSCROLL); rcClient.bottom += GetSystemMetrics(SM_CYHSCROLL);
if (PtInRect( &rect, pt )) if (PtInRect( &rcClient, ptClient ))
{ {
/* Check size box */ /* Check size box */
if ((wndPtr->dwStyle & WS_VSCROLL) && if ((wndPtr->dwStyle & WS_VSCROLL) &&
((((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rect.left + GetSystemMetrics(SM_CXVSCROLL))) || ((((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (ptClient.x <= rcClient.left + GetSystemMetrics(SM_CXVSCROLL))) ||
(((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))))) (((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (ptClient.x >= rcClient.right - GetSystemMetrics(SM_CXVSCROLL)))))
return HTSIZE; return HTSIZE;
return HTHSCROLL; return HTHSCROLL;
} }
...@@ -608,7 +609,7 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) ...@@ -608,7 +609,7 @@ static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt )
if (HAS_MENU(wndPtr)) if (HAS_MENU(wndPtr))
{ {
if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) if ((ptClient.y < 0) && (ptClient.x >= 0) && (ptClient.x < rcClient.right))
return HTMENU; return HTMENU;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment