Huw Davies : comctl32: Don' t store the width in the toolbar info structure.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 19 09:53:21 CDT 2015


Module: wine
Branch: master
Commit: 9d218048a6b0284f629ed85bfec59cb967b63e26
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9d218048a6b0284f629ed85bfec59cb967b63e26

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue May 19 12:51:54 2015 +0100

comctl32: Don't store the width in the toolbar info structure.

It's only set and used by a single function.

---

 dlls/comctl32/toolbar.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index b86ae9f..54a31ac 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -119,7 +119,6 @@ typedef struct
 typedef struct
 {
     DWORD    dwStructSize;    /* size of TBBUTTON struct */
-    INT      nWidth;          /* width of the toolbar */
     RECT     client_rect;
     RECT     rcBound;         /* bounding rectangle */
     INT      nButtonHeight;
@@ -1282,7 +1281,7 @@ static void
 TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
 {
     TBUTTON_INFO *btnPtr;
-    INT x, cx, i, j;
+    INT x, cx, i, j, width;
     RECT rc;
     BOOL bButtonWrap;
 
@@ -1302,18 +1301,18 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
          * toolbars in a rebar control
          */
         GetClientRect( GetParent(infoPtr->hwndSelf), &rc );
-        infoPtr->nWidth = rc.right - rc.left;
+        width = rc.right - rc.left;
     }
     else
     {
         GetWindowRect( infoPtr->hwndSelf, &rc );
-        infoPtr->nWidth = rc.right - rc.left;
+        width = rc.right - rc.left;
     }
 
     bButtonWrap = FALSE;
 
-    TRACE("start ButtonWidth=%d, BitmapWidth=%d, nWidth=%d, nIndent=%d\n",
-	  infoPtr->nButtonWidth, infoPtr->nBitmapWidth, infoPtr->nWidth,
+    TRACE("start ButtonWidth=%d, BitmapWidth=%d, width=%d, nIndent=%d\n",
+	  infoPtr->nButtonWidth, infoPtr->nBitmapWidth, width,
 	  infoPtr->nIndent);
 
     for (i = 0; i < infoPtr->nNumButtons; i++ )
@@ -1351,9 +1350,8 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
 	/* The layout makes sure the bitmap is visible, but not the button. */
 	/* Test added to also wrap after a button that starts a row but     */
 	/* is bigger than the area.  - GA  8/01                             */
-	if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2
-	   > infoPtr->nWidth ) ||
-	    ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth)))
+        if ((x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 > width) ||
+            ((x == infoPtr->nIndent) && (cx > width)))
 	{
 	    BOOL bFound = FALSE;
 
@@ -5946,7 +5944,6 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
     /* paranoid!! */
     infoPtr->dwStructSize = sizeof(TBBUTTON);
     infoPtr->nRows = 1;
-    infoPtr->nWidth = 0;
 
     /* initialize info structure */
     infoPtr->nButtonWidth = 23;




More information about the wine-cvs mailing list