Commit in reactos/lib/comctl32 on MAIN
listview.c+21.12 -> 1.13
propsheet.c+2061.8 -> 1.9
tab.c+27-181.8 -> 1.9
toolbar.c+52-521.15 -> 1.16
tooltips.c+104-341.5 -> 1.6
winehq2ros.patch+26-271.8 -> 1.9
+417-131
6 modified files
Sync to Wine-20040716:
Mike McCormack <mike@codeweavers.com>
- Create a tooltip on demand in the Listview.
Robert Shearman <rob@codeweavers.com>
- Implemented PSM_HWNDTOINDEX.
- Add stubs for some new property sheet messages.
- Clean up the mask drawing code.
- Improve bitmap not found message.
- Start of balloon tip support.
Jon Griffiths <jon_p_griffiths@yahoo.com>
- Don't crash on NULL tab text.
Filip Navara <xnavara@volny.cz>
- Make the pattern drawing in TOOLBAR_DrawPattern look better.

reactos/lib/comctl32
listview.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- listview.c	27 Jun 2004 11:24:43 -0000	1.12
+++ listview.c	8 Aug 2004 20:03:59 -0000	1.13
@@ -8954,6 +8954,8 @@
   /* case LVM_GETTILEVIEWINFO: */
 
   case LVM_GETTOOLTIPS:
+    if( !infoPtr->hwndToolTip )
+        infoPtr->hwndToolTip = COMCTL32_CreateToolTip( hwnd );
     return (LRESULT)infoPtr->hwndToolTip;
 
   case LVM_GETTOPINDEX:

reactos/lib/comctl32
propsheet.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- propsheet.c	16 Jun 2004 06:46:13 -0000	1.8
+++ propsheet.c	8 Aug 2004 20:04:00 -0000	1.9
@@ -2491,6 +2491,133 @@
 }
 
 /******************************************************************************
+ *            PROPSHEET_InsertPage
+ */
+static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
+{
+    if (!HIWORD(hpageInsertAfter))
+        FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage);
+    else
+        FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage);
+    return FALSE;
+}
+
+/******************************************************************************
+ *            PROPSHEET_SetHeaderTitleW
+ */
+static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderTitle)
+{
+    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderTitle));
+}
+
+/******************************************************************************
+ *            PROPSHEET_SetHeaderTitleA
+ */
+static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderTitle)
+{
+    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderTitle));
+}
+
+/******************************************************************************
+ *            PROPSHEET_SetHeaderSubTitleW
+ */
+static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderSubTitle)
+{
+    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderSubTitle));
+}
+
+/******************************************************************************
+ *            PROPSHEET_SetHeaderSubTitleA
+ */
+static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderSubTitle)
+{
+    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderSubTitle));
+}
+
+/******************************************************************************
+ *            PROPSHEET_HwndToIndex
+ */
+static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg)
+{
+    int index;
+    PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
+                                                       PropSheetInfoStr);
+
+    TRACE("(%p, %p)\n", hwndDlg, hPageDlg);
+
+    for (index = 0; index < psInfo->nPages; index++)
+        if (psInfo->proppage[index].hwndPage == hPageDlg)
+            return index;
+
+    WARN("%p not found\n", hPageDlg);
+
+    return -1;
+}
+
+/******************************************************************************
+ *            PROPSHEET_IndexToHwnd
+ */
+static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex)
+{
+    FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex);
+    return 0;
+}
+
+/******************************************************************************
+ *            PROPSHEET_PageToIndex
+ */
+static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage)
+{
+    FIXME("(%p, %p): stub\n", hwndDlg, hPage);
+    return -1;
+}
+
+/******************************************************************************
+ *            PROPSHEET_IndexToPage
+ */
+static LRESULT PROPSHEET_IndexToPage(HWND hwndDlg, int iPageIndex)
+{
+    FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex);
+    return 0;
+}
+
+/******************************************************************************
+ *            PROPSHEET_IdToIndex
+ */
+static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId)
+{
+    FIXME("(%p, %d): stub\n", hwndDlg, iPageId);
+    return -1;
+}
+
+/******************************************************************************
+ *            PROPSHEET_IndexToId
+ */
+static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex)
+{
+    FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex);
+    return 0;
+}
+
+/******************************************************************************
+ *            PROPSHEET_GetResult
+ */
+static LRESULT PROPSHEET_GetResult(HWND hwndDlg)
+{
+    FIXME("(%p): stub\n", hwndDlg);
+    return -1;
+}
+
+/******************************************************************************
+ *            PROPSHEET_RecalcPageSizes
+ */
+static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg)
+{
+    FIXME("(%p): stub\n", hwndDlg);
+    return FALSE;
+}
+
+/******************************************************************************
  *            PROPSHEET_GetPageIndex
  *
  * Given a HPROPSHEETPAGE, returns the index of the corresponding page from
@@ -3348,6 +3475,85 @@
         PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam);
         return FALSE;
 
+    case PSM_INSERTPAGE:
+    {
+        BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_SETHEADERTITLEW:
+        PROPSHEET_SetHeaderTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
+        return TRUE;
+
+    case PSM_SETHEADERTITLEA:
+        PROPSHEET_SetHeaderTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
+        return TRUE;
+
+    case PSM_SETHEADERSUBTITLEW:
+        PROPSHEET_SetHeaderSubTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
+        return TRUE;
+
+    case PSM_SETHEADERSUBTITLEA:
+        PROPSHEET_SetHeaderSubTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
+        return TRUE;
+
+    case PSM_HWNDTOINDEX:
+    {
+        LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_INDEXTOHWND:
+    {
+        LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_PAGETOINDEX:
+    {
+        LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_INDEXTOPAGE:
+    {
+        LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_IDTOINDEX:
+    {
+        LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_INDEXTOID:
+    {
+        LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_GETRESULT:
+    {
+        LRESULT msgResult = PROPSHEET_GetResult(hwnd);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
+    case PSM_RECALCPAGESIZES:
+    {
+        LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd);
+        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        return TRUE;
+    }
+
     default:
       return FALSE;
   }

reactos/lib/comctl32
tab.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- tab.c	16 Jun 2004 06:46:13 -0000	1.8
+++ tab.c	8 Aug 2004 20:04:00 -0000	1.9
@@ -1145,7 +1145,7 @@
     /* Set the leftmost position of the tab. */
     infoPtr->items[curItem].rect.left = curItemLeftPos;
 
-    if (lStyle & TCS_FIXEDWIDTH)
+    if ((lStyle & TCS_FIXEDWIDTH) || !infoPtr->items[curItem].pszText)
     {
       infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
         max(infoPtr->tabWidth, icon_width);
@@ -1682,8 +1682,11 @@
     rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
 
     /* get the rectangle that the text fits in */
-    DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
-              &rcText, DT_CALCRECT);
+    if (infoPtr->items[iItem].pszText)
+    {
+      DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
+                &rcText, DT_CALCRECT);
+    }
     /*
      * If not owner draw, then do the drawing ourselves.
      *
@@ -1824,14 +1827,17 @@
       hFont = CreateFontIndirectA(&logfont);
       SelectObject(hdc, hFont);
 
-      ExtTextOutW(hdc,
-      (lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
-      (!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
-      ETO_CLIPPED,
-      drawRect,
-      infoPtr->items[iItem].pszText,
-      lstrlenW(infoPtr->items[iItem].pszText),
-      0);
+      if (infoPtr->items[iItem].pszText)
+      {
+        ExtTextOutW(hdc,
+        (lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
+        (!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
+        ETO_CLIPPED,
+        drawRect,
+        infoPtr->items[iItem].pszText,
+        lstrlenW(infoPtr->items[iItem].pszText),
+        0);
+      }
 
       DeleteObject(hFont);
     }
@@ -1841,14 +1847,17 @@
 	  debugstr_w(infoPtr->items[iItem].pszText), center_offset_h, center_offset_v,
 	  drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
 	  (rcText.right-rcText.left));
-      DrawTextW
-      (
-        hdc,
-        infoPtr->items[iItem].pszText,
-        lstrlenW(infoPtr->items[iItem].pszText),
-        drawRect,
-        DT_LEFT | DT_SINGLELINE
+      if (infoPtr->items[iItem].pszText)
+      {
+        DrawTextW
+        (
+          hdc,
+          infoPtr->items[iItem].pszText,
+          lstrlenW(infoPtr->items[iItem].pszText),
+          drawRect,
+          DT_LEFT | DT_SINGLELINE
         );
+      }
     }
 
     *drawRect = rcTemp; /* restore drawRect */

reactos/lib/comctl32
toolbar.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- toolbar.c	16 Jun 2004 06:46:13 -0000	1.15
+++ toolbar.c	8 Aug 2004 20:04:00 -0000	1.16
@@ -407,7 +407,7 @@
 
     if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
 	if (btnPtr->iBitmap == I_IMAGENONE) return NULL;
-	ERR("index %d,%d is not valid, max %d\n",
+	ERR("bitmap for ID %d, index %d is not valid, number of bitmaps in imagelist: %d\n",
 	    HIWORD(btnPtr->iBitmap), LOWORD(btnPtr->iBitmap), infoPtr->nNumBitmaps);
 	return NULL;
     }
@@ -634,61 +634,53 @@
     INT cy = lpRect->bottom - lpRect->top;
     clrTextOld = SetTextColor(hdc, tbcd->clrBtnHighlight);
     clrBkOld = SetBkColor(hdc, tbcd->clrBtnFace);
-    PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, PATCOPY);
+    PatBlt (hdc, lpRect->left + 2, lpRect->top + 2, cx - 4, cy - 4, PATCOPY);
     SetBkColor(hdc, clrBkOld);
     SetTextColor(hdc, clrTextOld);
     SelectObject (hdc, hbr);
 }
 
 
-static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
-                               HDC hdc, INT x, INT y)
+static void TOOLBAR_DrawMasked(HIMAGELIST himl, int index, HDC hdc, INT x, INT y, UINT draw_flags)
 {
-    int index;
-    HIMAGELIST himl = 
-        TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
-
-    if (himl)
-    {
-        INT cx, cy;
-        HBITMAP hbmMask, hbmImage;
-        HDC hdcMask, hdcImage;
-
-        ImageList_GetIconSize(himl, &cx, &cy);
-
-        /* Create src image */
-        hdcImage = CreateCompatibleDC(hdc);
-        hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES),
-                                GetDeviceCaps(hdc,BITSPIXEL), NULL);
-        SelectObject(hdcImage, hbmImage);
-        ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
-                         RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL);
-
-        /* Create Mask */
-        hdcMask = CreateCompatibleDC(0);
-        hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
-        SelectObject(hdcMask, hbmMask);
-
-        /* Remove the background and all white pixels */
-        SetBkColor(hdcImage, ImageList_GetBkColor(himl));
-        BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, SRCCOPY);
-        SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff));
-        BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE);
-
-        /* draw the new mask 'etched' to hdc */
-        SetBkColor(hdc, RGB(255, 255, 255));
-        SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT));
-        /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
-        BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
-        SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW));
-        BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
-
-        /* Cleanup */
-        DeleteObject(hbmImage);
-        DeleteDC(hdcImage);
-        DeleteObject (hbmMask);
-        DeleteDC(hdcMask);
-    }
+    INT cx, cy;
+    HBITMAP hbmMask, hbmImage;
+    HDC hdcMask, hdcImage;
+
+    ImageList_GetIconSize(himl, &cx, &cy);
+
+    /* Create src image */
+    hdcImage = CreateCompatibleDC(hdc);
+    hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES),
+                            GetDeviceCaps(hdc,BITSPIXEL), NULL);
+    SelectObject(hdcImage, hbmImage);
+    ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
+                     RGB(0xff, 0xff, 0xff), RGB(0,0,0), draw_flags);
+
+    /* Create Mask */
+    hdcMask = CreateCompatibleDC(0);
+    hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
+    SelectObject(hdcMask, hbmMask);
+
+    /* Remove the background and all white pixels */
+    SetBkColor(hdcImage, ImageList_GetBkColor(himl));
+    BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, SRCCOPY);
+    SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff));
+    BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE);
+
+    /* draw the new mask 'etched' to hdc */
+    SetBkColor(hdc, RGB(255, 255, 255));
+    SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT));
+    /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
+    BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
+    SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW));
+    BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
+
+    /* Cleanup */
+    DeleteObject(hbmImage);
+    DeleteDC(hdcImage);
+    DeleteObject (hbmMask);
+    DeleteDC(hdcMask);
 }
 
 
@@ -721,7 +713,10 @@
     {
         himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DISABLED, &index);
         if (!himl)
-           draw_masked = TRUE;
+        {
+            himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
+            draw_masked = TRUE;
+        }
     }
     else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (infoPtr->dwStyle & TBSTYLE_FLAT))
     {
@@ -734,6 +729,9 @@
     else
         himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
 
+    if (!himl)
+        return;
+
     if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) && 
         (tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED)))
         offset = 1;
@@ -746,8 +744,8 @@
       index, himl, left, top, offset);
 
     if (draw_masked)
-        TOOLBAR_DrawMasked (infoPtr, btnPtr, tbcd->nmcd.hdc, left + offset, top + offset);
-    else if (himl)
+        TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
+    else
         ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
 }
 
@@ -5313,6 +5311,8 @@
     NMTOOLBARA nmtb;
     BOOL bDragKeyPressed;
 
+    TRACE("\n");
+
     if (infoPtr->dwStyle & TBSTYLE_ALTDRAG)
         bDragKeyPressed = (GetKeyState(VK_MENU) < 0);
     else

reactos/lib/comctl32
tooltips.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- tooltips.c	15 Apr 2004 08:29:57 -0000	1.5
+++ tooltips.c	8 Aug 2004 20:04:00 -0000	1.6
@@ -130,6 +130,12 @@
 
 #define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongA (hWindow, 0))
 
+/* offsets from window edge to start of text */
+#define NORMAL_TEXT_MARGIN 2
+#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+10)
+/* value used for CreateRoundRectRgn that specifies how much
+ * each corner is curved */
+#define BALLOON_ROUNDEDNESS 20
 
 LRESULT CALLBACK
 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef);
@@ -144,6 +150,8 @@
     HFONT hOldFont;
     HBRUSH hBrush;
     UINT uFlags = DT_EXTERNALLEADING;
+    HRGN hRgn = NULL;
+    DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
 
     if (infoPtr->nMaxTipWidth > -1)
 	uFlags |= DT_WORDBREAK;
@@ -151,25 +159,63 @@
 	uFlags |= DT_NOPREFIX;
     GetClientRect (hwnd, &rc);
 
-    /* fill the background */
-    hBrush = CreateSolidBrush (infoPtr->clrBk);
-    FillRect (hdc, &rc, hBrush);
-    DeleteObject (hBrush);
-
-    /* calculate text rectangle */
-    rc.left   += (2 + infoPtr->rcMargin.left);
-    rc.top    += (2 + infoPtr->rcMargin.top);
-    rc.right  -= (2 + infoPtr->rcMargin.right);
-    rc.bottom -= (2 + infoPtr->rcMargin.bottom);
+    hBrush = CreateSolidBrush(infoPtr->clrBk);
 
-    /* draw text */
+    if (dwStyle & TTS_BALLOON)
+    {
+        /* create a region to store result into */
+        hRgn = CreateRectRgn(0, 0, 0, 0);
+
+        GetWindowRgn(hwnd, hRgn);
+
+        /* fill the background */
+        FillRgn(hdc, hRgn, hBrush);
+        DeleteObject(hBrush);
+        hBrush = NULL;
+
+        /* calculate text rectangle */
+        rc.left   += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left);
+        rc.top    += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top);
+        rc.right  -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right);
+        rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom);
+    }
+    else
+    {
+        /* fill the background */
+        FillRect(hdc, &rc, hBrush);
+        DeleteObject(hBrush);
+        hBrush = NULL;
+
+        /* calculate text rectangle */
+        rc.left   += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left);
+        rc.top    += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top);
+        rc.right  -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.right);
+        rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom);
+    }
+
+    /* already drawn the background; don't need to draw it again
+     * when drawing text */
     oldBkMode = SetBkMode (hdc, TRANSPARENT);
     SetTextColor (hdc, infoPtr->clrText);
     hOldFont = SelectObject (hdc, infoPtr->hFont);
+    /* draw text */
     DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
+    /* be polite and reset the things we changed in the dc */
     SelectObject (hdc, hOldFont);
-    if (oldBkMode != TRANSPARENT)
-	SetBkMode (hdc, oldBkMode);
+    SetBkMode (hdc, oldBkMode);
+
+    if (dwStyle & TTS_BALLOON)
+    {
+        /* frame region because default window proc doesn't do it */
+        INT width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
+        INT height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
+
+        hBrush = GetSysColorBrush(COLOR_WINDOWFRAME);
+        FrameRgn(hdc, hRgn, hBrush, width, height);
+    }
+
+    if (hRgn)
+        DeleteObject(hRgn);
 }
 
 static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
@@ -322,10 +368,20 @@
     SelectObject (hdc, hOldFont);
     ReleaseDC (hwnd, hdc);
 
-    lpSize->cx = rc.right - rc.left + 4 +
-		 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
-    lpSize->cy = rc.bottom - rc.top + 4 +
-		 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
+    if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON)
+    {
+        lpSize->cx = rc.right - rc.left + 2*BALLOON_TEXT_MARGIN +
+                       infoPtr->rcMargin.left + infoPtr->rcMargin.right;
+        lpSize->cy = rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
+                       infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
+    }
+    else
+    {
+        lpSize->cx = rc.right - rc.left + 2*NORMAL_TEXT_MARGIN +
+                       infoPtr->rcMargin.left + infoPtr->rcMargin.right;
+        lpSize->cy = rc.bottom - rc.top + 2*NORMAL_TEXT_MARGIN +
+                       infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
+    }
 }
 
 
@@ -412,6 +468,18 @@
     AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
 			FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
 
+    if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON)
+    {
+        HRGN hRgn;
+
+        /* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */
+        hRgn = CreateRoundRectRgn(0, 0, rect.right - rect.left, rect.bottom - rect.top, BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
+
+        SetWindowRgn(hwnd, hRgn, FALSE);
+        /* we don't free the region handle as the system deletes it when 
+         * it is no longer needed */
+    }
+
     SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
 		    rect.right - rect.left, rect.bottom - rect.top,
 		    SWP_SHOWWINDOW | SWP_NOACTIVATE);
@@ -531,6 +599,18 @@
     AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
 			FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
 
+    if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON)
+    {
+        HRGN hRgn;
+
+        /* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */
+        hRgn = CreateRoundRectRgn(0, 0, rect.right - rect.left, rect.bottom - rect.top, BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
+
+        SetWindowRgn(hwnd, hRgn, FALSE);
+        /* we don't free the region handle as the system deletes it when 
+         * it is no longer needed */
+    }
+
     SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
 		    rect.right - rect.left, rect.bottom - rect.top,
 		    SWP_SHOWWINDOW | SWP_NOACTIVATE );
@@ -2025,22 +2105,6 @@
 
 
 static LRESULT
-TOOLTIPS_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
-    RECT rect;
-    HBRUSH hBrush;
-
-    hBrush = CreateSolidBrush (infoPtr->clrBk);
-    GetClientRect (hwnd, &rect);
-    FillRect ((HDC)wParam, &rect, hBrush);
-    DeleteObject (hBrush);
-
-    return FALSE;
-}
-
-
-static LRESULT
 TOOLTIPS_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -2068,6 +2132,11 @@
 
     dwStyle &= 0x0000FFFF;
     dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
+
+    /* WS_BORDER only draws a border round the window rect, not the
+     * window region, therefore it is useless to us in balloon mode */
+    if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER;
+
     SetWindowLongA (hwnd, GWL_STYLE, dwStyle);
 
     dwExStyle |= WS_EX_TOOLWINDOW;
@@ -2405,7 +2474,8 @@
 	    return TOOLTIPS_Destroy (hwnd, wParam, lParam);
 
 	case WM_ERASEBKGND:
-	    return TOOLTIPS_EraseBackground (hwnd, wParam, lParam);
+	    /* we draw the background in WM_PAINT */
+	    return 0;
 
 	case WM_GETFONT:
 	    return TOOLTIPS_GetFont (hwnd, wParam, lParam);

reactos/lib/comctl32
winehq2ros.patch 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- winehq2ros.patch	16 Jun 2004 06:46:13 -0000	1.8
+++ winehq2ros.patch	8 Aug 2004 20:04:00 -0000	1.9
@@ -4,7 +4,7 @@
 retrieving revision 1.44
 diff -u -r1.44 comctl32.spec
 --- comctl32.spec	17 May 2004 20:51:27 -0000	1.44
-+++ comctl32.spec	16 Jun 2004 06:51:02 -0000
++++ comctl32.spec	8 Aug 2004 13:10:59 -0000
 @@ -106,13 +106,13 @@
  412 stdcall RemoveWindowSubclass(long ptr long)
  413 stdcall DefSubclassProc(long long long long)
@@ -26,34 +26,13 @@
  
  # Functions imported by name
  
-Index: imagelist.c
-===================================================================
-RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v
-retrieving revision 1.85
-diff -u -r1.85 imagelist.c
---- imagelist.c	27 Feb 2004 04:40:08 -0000	1.85
-+++ imagelist.c	16 Jun 2004 06:51:02 -0000
-@@ -1146,11 +1146,13 @@
-     	PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY);
-     	SelectObject(hBlendMaskDC, hOldBrush);
- 
-+#if 0
-     	/* Modify the blend mask if an Image Mask exist */
-     	if(himl->hbmMask) {
- 	    BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, lx, ly, 0x220326); /* NOTSRCAND */
- 	    BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY);
- 	}
-+#endif
- 	
- 	/* now apply blend to the current image given the BlendMask */
-         if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT);
 Index: listview.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
-retrieving revision 1.389
-diff -u -r1.389 listview.c
---- listview.c	4 Jun 2004 17:58:29 -0000	1.389
-+++ listview.c	16 Jun 2004 06:51:06 -0000
+retrieving revision 1.390
+diff -u -r1.390 listview.c
+--- listview.c	6 Jul 2004 21:27:34 -0000	1.390
++++ listview.c	8 Aug 2004 13:11:03 -0000
 @@ -147,6 +147,7 @@
  #include <assert.h>
  #include <ctype.h>
@@ -62,13 +41,33 @@
  #include <stdlib.h>
  #include <stdarg.h>
  #include <stdio.h>
+@@ -2023,7 +2024,8 @@
+ 		         infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
+ 	    Label.right = Label.left + labelSize.cx;
+ 	    Label.bottom = Label.top + infoPtr->nItemHeight;
+-	    if (!oversizedBox && labelSize.cy > infoPtr->ntmHeight)
++	    if (!oversizedBox && labelSize.cy > infoPtr->ntmHeight &&
++	        infoPtr->ntmHeight)
+ 	    {
+ 		labelSize.cy = min(Box.bottom - Label.top, labelSize.cy);
+ 		labelSize.cy /= infoPtr->ntmHeight;
+@@ -9517,7 +9519,8 @@
+         hOldFont = SelectObject(hdc, infoPtr->hFont);
+ 
+     /*Get String Length in pixels */
+-    GetTextExtentPoint32W(hdc, text, lstrlenW(text), &sz);
++    if(!GetTextExtentPoint32W(hdc, text, lstrlenW(text), &sz))
++        sz.cx = 0;
+ 
+     /*Add Extra spacing for the next character */
+     GetTextMetricsW(hdc, &textMetric);
 Index: string.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/comctl32/string.c,v
 retrieving revision 1.4
 diff -u -r1.4 string.c
 --- string.c	17 May 2004 20:51:27 -0000	1.4
-+++ string.c	16 Jun 2004 06:51:06 -0000
++++ string.c	8 Aug 2004 13:11:03 -0000
 @@ -254,7 +254,7 @@
  {
    TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
CVSspam 0.2.8