[0.4.8][COMCTL32] Workaround regression with toolbar in 7zip CORE-16169
authorJoachim Henze <Joachim.Henze@reactos.org>
Sun, 23 Jan 2022 13:00:28 +0000 (14:00 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Sun, 23 Jan 2022 13:00:28 +0000 (14:00 +0100)
The regression was introduced by SVN r68553 == git 3b13364f058238213d85a461725002330d3743f9

Many thanks to the author Doug Lyons for excellent
cooperation once more. Always a pleasure.

Fix cherry picked from commits:
0.4.15-dev-663-g cd7db5df89d3f9e8ddce6e909debedc423e3e8a1 and
0.4.15-dev-664-g 7c909cbc7c58484337ffa1a34f92449fcf2eb41e

dll/win32/comctl32/toolbar.c

index 949eadb..0879f0a 100644 (file)
@@ -1439,6 +1439,11 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
     if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) &&
        !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL) )  return;
 
+#ifdef __REACTOS__ /* workaround CORE-16169 part 1 of 2 */
+    /* if width is zero then return */
+    if (infoPtr->client_rect.right == 0) return;
+#endif
+
     btnPtr = infoPtr->buttons;
     x  = infoPtr->nIndent;
     width = infoPtr->client_rect.right - infoPtr->client_rect.left;
@@ -3189,6 +3194,14 @@ TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr)
     TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
     TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
 
+#ifdef __REACTOS__ /* workaround CORE-16169 part 2 of 2 */
+    if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
+    {
+        TOOLBAR_LayoutToolbar(infoPtr);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
+    }
+#endif
+
     if (!(infoPtr->dwStyle & CCS_NORESIZE))
     {
         RECT window_rect, parent_rect;