comctl32: TOOLBAR_SetImageList should recalulate toolbar only if it is necessary
Igor Tarasov
tarasov.igor at gmail.com
Sun Apr 19 10:14:20 CDT 2009
Forgot the patch :)
2009/4/19 Igor Tarasov <tarasov.igor at gmail.com>:
> Currently TOOLBAR_SetImageList recalculates toolbar and button sizes
> even if there is no need in this (when new image list bitmap sizes are
> equal to toolbar bitmap sizes). This overwrites button sizes that
> might have been defined by application, and thus leads to visual
> glitches. Native comctl does not change any toolbar sizes on
> TB_SETIMAGELIST when bitmap size is the same.
>
> More details: http://bugs.winehq.org/show_bug.cgi?id=12553#c22
>
> --
> Igor
>
--
Igor
-------------- next part --------------
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index fe4c539..3eeede1 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -4780,6 +4780,8 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
HIMAGELIST himlTemp;
HIMAGELIST himl = (HIMAGELIST)lParam;
INT oldButtonWidth = infoPtr->nButtonWidth;
+ INT bitmapWidth = infoPtr->nBitmapWidth;
+ INT bitmapHeight = infoPtr->nBitmapHeight;
INT i, id = 0;
if (infoPtr->iVersion >= 5)
@@ -4792,15 +4794,18 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
for (i = 0; i < infoPtr->cimlDef; i++)
infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
- if (!ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
- &infoPtr->nBitmapHeight))
+ if (!ImageList_GetIconSize(himl, &bitmapWidth, &bitmapHeight))
{
infoPtr->nBitmapWidth = 1;
infoPtr->nBitmapHeight = 1;
}
- TOOLBAR_CalcToolbar(hwnd);
- if (infoPtr->nButtonWidth < oldButtonWidth)
- TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight));
+ if ((bitmapWidth != infoPtr->nBitmapWidth) || (bitmapHeight != infoPtr->nBitmapHeight)) {
+ infoPtr->nBitmapWidth = bitmapWidth;
+ infoPtr->nBitmapHeight = bitmapHeight;
+ TOOLBAR_CalcToolbar(hwnd);
+ if (infoPtr->nButtonWidth < oldButtonWidth)
+ TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight));
+ }
TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
More information about the wine-patches
mailing list