COMCTL32: Minor corrections

Robert Shearman rob at codeweavers.com
Sat Dec 4 17:48:59 CST 2004


Filip Navara wrote:

> Changelog:
> - Tooltip icons must be destroyed with DestroyIcon and not with 
> DeleteObject.
> - Don't use DrawEdge with NULL device context, it's invalid call and 
> sets last error.
>
>------------------------------------------------------------------------
>
>Index: lib/comctl32/datetime.c
>===================================================================
>RCS file: /CVS/ReactOS/reactos/lib/comctl32/datetime.c,v
>retrieving revision 1.5
>diff -u -r1.5 datetime.c
>--- lib/comctl32/datetime.c	19 Sep 2004 09:50:06 -0000	1.5
>+++ lib/comctl32/datetime.c	4 Dec 2004 22:59:42 -0000
>@@ -1170,10 +1170,10 @@
> 
>   TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
> 
>-  /* use DrawEdge to adjust the size of rcEdge to get rcDraw */
>   memcpy((&infoPtr->rcDraw), (&infoPtr->rcClient), sizeof(infoPtr->rcDraw));
> 
>-  DrawEdge(NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST);
>+  /* subract the size of the edge drawn by DrawEdge */
>+  InflateRect(&infoPtr->rcDraw, -2, -2);
>  
>

Please use GetSystemMetrics(SM_CXEDGE) and GetSystemMetrics(SM_CYEDGE).

> 
>   /* set the size of the button that drops the calendar down */
>   /* FIXME: account for style that allows button on left side */
>Index: lib/comctl32/tooltips.c
>===================================================================
>RCS file: /CVS/ReactOS/reactos/lib/comctl32/tooltips.c,v
>retrieving revision 1.9
>diff -u -r1.9 tooltips.c
>--- lib/comctl32/tooltips.c	20 Oct 2004 08:36:55 -0000	1.9
>+++ lib/comctl32/tooltips.c	4 Dec 2004 23:18:56 -0000
>@@ -2818,7 +2818,7 @@
> TOOLTIPS_Unregister (void)
> {
>     int i;
>-    for (i = 0; i < TTI_ERROR+1; i++)
>-        DeleteObject(hTooltipIcons[i]);
>+    for (i = TTI_INFO; i <= TTI_ERROR; i++)
>+        DestroyIcon(hTooltipIcons[i]);
>     UnregisterClassW (TOOLTIPS_CLASSW, NULL);
> }
>  
>

Someone already sent a patch for this (and it is my buggy code, sorry). 
Not sure why it didn't go in, but it should.

Rob



More information about the wine-devel mailing list