Thomas Weidenmueller : comctl32: Some painting fixes for the syslink control.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 6 06:17:06 CST 2006


Module: wine
Branch: refs/heads/master
Commit: adc416b756b52c2ee6db6455dc3c112af64716f3
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=adc416b756b52c2ee6db6455dc3c112af64716f3

Author: Thomas Weidenmueller <wine-patches at reactsoft.com>
Date:   Fri Jan  6 13:04:14 2006 +0100

comctl32: Some painting fixes for the syslink control.

---

 dlls/comctl32/syslink.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c
index 7459bc3..1938814 100644
--- a/dlls/comctl32/syslink.c
+++ b/dlls/comctl32/syslink.c
@@ -877,10 +877,10 @@ static LRESULT SYSLINK_Draw (SYSLINK_INF
                 ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL);
                 if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
                 {
-                    COLORREF PrevColor;
-                    PrevColor = SetBkColor(hdc, OldBkColor);
+                    COLORREF PrevTextColor;
+                    PrevTextColor = SetTextColor(hdc, infoPtr->TextColor);
                     DrawFocusRect(hdc, &bl->rc);
-                    SetBkColor(hdc, PrevColor);
+                    SetTextColor(hdc, PrevTextColor);
                 }
                 tx += bl->nChars;
                 n -= bl->nChars + bl->nSkip;
@@ -907,8 +907,11 @@ static LRESULT SYSLINK_Paint (SYSLINK_IN
     PAINTSTRUCT ps;
 
     hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps);
-    SYSLINK_Draw (infoPtr, hdc);
-    if (!hdcParam) EndPaint (infoPtr->Self, &ps);
+    if (hdc)
+    {
+        SYSLINK_Draw (infoPtr, hdc);
+        if (!hdcParam) EndPaint (infoPtr->Self, &ps);
+    }
     return 0;
 }
 
@@ -972,8 +975,7 @@ static LRESULT SYSLINK_SetText (SYSLINK_
     /* clear the document */
     SYSLINK_ClearDoc(infoPtr);
     
-    textlen = lstrlenW(Text);
-    if(Text == NULL || textlen == 0)
+    if(Text == NULL || (textlen = lstrlenW(Text)) == 0)
     {
         return TRUE;
     }
@@ -983,9 +985,13 @@ static LRESULT SYSLINK_SetText (SYSLINK_
     {
         /* Render text position and word wrapping in memory */
         HDC hdc = GetDC(infoPtr->Self);
-        SYSLINK_Render(infoPtr, hdc);
-        SYSLINK_Draw(infoPtr, hdc);
-        ReleaseDC(infoPtr->Self, hdc);
+        if (hdc != NULL)
+        {
+            SYSLINK_Render(infoPtr, hdc);
+            ReleaseDC(infoPtr->Self, hdc);
+
+            InvalidateRect(infoPtr->Self, NULL, TRUE);
+        }
     }
     
     return TRUE;




More information about the wine-cvs mailing list