comctl32: rebar: Don't return rectangles with negative width or height in NCCalcSize.

oldstable
Mikołaj Zalewski 2006-10-16 17:39:55 +02:00 committed by Alexandre Julliard
parent a82b96f1b5
commit 1b8c98d35d
1 changed files with 8 additions and 6 deletions

View File

@ -4114,17 +4114,19 @@ inline static LRESULT
REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
HTHEME theme;
RECT *rect = (RECT *)lParam;
if (infoPtr->dwStyle & WS_BORDER) {
InflateRect((LPRECT)lParam, -GetSystemMetrics(SM_CXEDGE),
-GetSystemMetrics(SM_CYEDGE));
rect->left = min(rect->left + GetSystemMetrics(SM_CXEDGE), rect->right);
rect->right = max(rect->right - GetSystemMetrics(SM_CXEDGE), rect->left);
rect->top = min(rect->top + GetSystemMetrics(SM_CXEDGE), rect->bottom);
rect->bottom = max(rect->bottom - GetSystemMetrics(SM_CXEDGE), rect->top);
}
else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
{
((LPRECT)lParam)->top++;
rect->top = min(rect->top + 1, rect->bottom);
}
TRACE("new client=(%d,%d)-(%d,%d)\n",
((LPRECT)lParam)->left, ((LPRECT)lParam)->top,
((LPRECT)lParam)->right, ((LPRECT)lParam)->bottom);
TRACE("new client=(%d,%d)-(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
return 0;
}