[PATCH] comctl32: toolbar: TB_SETBUTTONINFO should do a relayout instead of a recalc

Mikołaj Zalewski mikolaj at zalewski.pl
Sun Feb 1 06:05:03 CST 2009


---
 dlls/comctl32/tests/toolbar.c |   10 ++++++++++
 dlls/comctl32/toolbar.c       |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 37dd6f7..2dcf643 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -1028,6 +1028,8 @@ static BOOL did_recalc(HWND hToolbar)
 static void test_recalc()
 {
     HWND hToolbar;
+    TBBUTTONINFO bi;
+    CHAR test[] = "Test";
 
     /* Like TB_ADDBUTTONS tested in test_sized, inserting a button without text
      * results in a relayout, while adding one with text forces a recalc */
@@ -1039,6 +1041,14 @@ static void test_recalc()
     SendMessage(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons3[3]);
     ok(did_recalc(hToolbar), "Expected a recalc - adding button with text\n");
 
+    /* TB_SETBUTTONINFO, even when adding a text, results only in a relayout */
+    prepare_recalc_test(&hToolbar);
+    bi.cbSize = sizeof(bi);
+    bi.dwMask = TBIF_TEXT;
+    bi.pszText = test;
+    SendMessage(hToolbar, TB_SETBUTTONINFO, 1, (LPARAM)&bi);
+    ok(!did_recalc(hToolbar), "Unexpected recalc - setting a button text\n");
+
     DestroyWindow(hToolbar);
 }
 
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 248a412..cec2116 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -4447,7 +4447,7 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* save the button rect to see if we need to redraw the whole toolbar */
     oldBtnRect = btnPtr->rect;
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(hwnd);
 
     if (!EqualRect(&oldBtnRect, &btnPtr->rect))
         InvalidateRect(hwnd, NULL, TRUE);
@@ -4500,7 +4500,7 @@ TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* save the button rect to see if we need to redraw the whole toolbar */
     oldBtnRect = btnPtr->rect;
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(hwnd);
 
     if (!EqualRect(&oldBtnRect, &btnPtr->rect))
         InvalidateRect(hwnd, NULL, TRUE);
-- 
1.5.4


--------------040805080601060709020800--



More information about the wine-patches mailing list