comctl32: fix regression caused by 2d751ee56afced908d0788b936fa4aac1b29f1a1

Igor Tarasov tarasov.igor at gmail.com
Fri Apr 17 20:51:40 CDT 2009


Fixing regression produced by "comctl32: Correct handling of toolbar
separators size". As it came out, some applications DO rely on iBitmap
value, but it can be received not with TB_GETBUTTONINFO, but with
TB_GETBITMAP.

So, real separator width is controlled by both iBitmap (usually set in
creation time) and cx, with cx having higher precedence. This patch
copies native behavior closer.

Also, with CCS_VERT iBitmap controls not width, but height, while cx
still controls width, and default width equals to toolbar's width, not
buttons (vertical toolbars may have more than 1 button in row, and
with native comctl32 separators take full width).

-- 
Igor
-------------- next part --------------
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index fe4c539..faac97c 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -1331,7 +1331,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
         /* horizontal separators are treated as buttons for width    */
 	else if ((btnPtr[i].fsStyle & BTNS_SEP) &&
             !(infoPtr->dwStyle & CCS_VERT))
-	    cx = SEPARATOR_WIDTH;
+            cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH;
 	else
 	    cx = infoPtr->nButtonWidth;
 
@@ -1683,11 +1683,12 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
 
 	if (btnPtr->fsStyle & BTNS_SEP) {
 	    if (infoPtr->dwStyle & CCS_VERT) {
-                cy = SEPARATOR_WIDTH;
-                cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nButtonWidth;
+                cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH;
+                cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nWidth;
 	    }
 	    else
-                cx = (btnPtr->cx > 0) ? btnPtr->cx : SEPARATOR_WIDTH;
+                cx = (btnPtr->cx > 0) ? btnPtr->cx :
+                    (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH;
 	}
 	else
 	{
@@ -1835,11 +1836,7 @@ TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButto
 
         ZeroMemory(btnPtr, sizeof(*btnPtr));
 
-        /* When inserting separator, iBitmap controls it's size */
-        if (lpTbb[iButton].fsStyle & BTNS_SEP) {
-            btnPtr->cx        = lpTbb[iButton].iBitmap;
-        } else
-            btnPtr->iBitmap   = lpTbb[iButton].iBitmap;
+        btnPtr->iBitmap   = lpTbb[iButton].iBitmap;
         btnPtr->idCommand = lpTbb[iButton].idCommand;
         btnPtr->fsState   = lpTbb[iButton].fsState;
         btnPtr->fsStyle   = lpTbb[iButton].fsStyle;


More information about the wine-patches mailing list