Nikolay Sivov : comctl32/listview: Setting item text to callback stub value already having it raises item-change notifications .

Alexandre Julliard julliard at winehq.org
Mon Jun 15 07:59:13 CDT 2009


Module: wine
Branch: master
Commit: 7f936a0a6e83538df7929528174846c03e23fba6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7f936a0a6e83538df7929528174846c03e23fba6

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Mon Jun 15 01:31:45 2009 +0400

comctl32/listview: Setting item text to callback stub value already having it raises item-change notifications.

Use same new text comparison rules for both items and subitems.
Based on patch by Stefan Stranz.

---

 dlls/comctl32/listview.c       |   13 ++++++-------
 dlls/comctl32/tests/listview.c |    2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 60d5d63..fd377ff 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -507,7 +507,7 @@ static inline int textcmpWT(LPCWSTR aw, LPCWSTR bt, BOOL isW)
     if (!aw) return bt ? -1 : 0;
     if (!bt) return aw ? 1 : 0;
     if (aw == LPSTR_TEXTCALLBACKW)
-	return bt == LPSTR_TEXTCALLBACKW ? 0 : -1;
+	return bt == LPSTR_TEXTCALLBACKW ? 1 : -1;
     if (bt != LPSTR_TEXTCALLBACKW)
     {
 	LPWSTR bw = textdupTtoW(bt, isW);
@@ -3727,12 +3727,11 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
 	    *bChanged = TRUE;
 	}
 
-    if (lpLVItem->mask & LVIF_TEXT)
-	if (lpSubItem->hdr.pszText != lpLVItem->pszText)
-	{
-	    textsetptrT(&lpSubItem->hdr.pszText, lpLVItem->pszText, isW);
-	    *bChanged = TRUE;
-	}
+    if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpSubItem->hdr.pszText, lpLVItem->pszText, isW))
+    {
+        textsetptrT(&lpSubItem->hdr.pszText, lpLVItem->pszText, isW);
+        *bChanged = TRUE;
+    }
 
     return TRUE;
 }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 3895bea..d28fc1b 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1118,7 +1118,7 @@ static void test_items(void)
     expect(TRUE, r);
 
     ok_sequence(sequences, PARENT_SEQ_INDEX, textcallback_set_again_parent_seq,
-                "check callback text comparison rule", TRUE);
+                "check callback text comparison rule", FALSE);
 
     DestroyWindow(hwnd);
 }




More information about the wine-cvs mailing list