comctl32: rebar: don't return rectangles with negative width or
height in NCCalcSize (fixes bug #3797)
Mikołaj Zalewski
mikolaj at zalewski.pl
Mon Oct 16 10:39:55 CDT 2006
CreateWindow doesn't like them
-------------- next part --------------
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index c627a3e..d2c8b94 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -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;
}
--
1.4.2.3
More information about the wine-patches
mailing list