Module: wine Branch: master Commit: 0517abf184cdc863b74b953b2acfecb1b331ed1b URL: http://source.winehq.org/git/wine.git/?a=commit;h=0517abf184cdc863b74b953b2a...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Nov 17 13:46:42 2010 +0300
comctl32/treeview: Use a code set by dispinfo holder to convert data encoding after TVN_GETDISPINFO.
---
dlls/comctl32/tests/treeview.c | 29 ++++++++++++++++++++++++----- dlls/comctl32/treeview.c | 5 +++-- 2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index dddaa9d..ffc0e3e 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -35,6 +35,11 @@
static const char *TEST_CALLBACK_TEXT = "callback_text";
+static TVITEMA g_item_expanding, g_item_expanded; +static BOOL g_get_from_expand; +static BOOL g_get_rect_in_expand; +static BOOL g_disp_A_to_W; + #define NUM_MSG_SEQUENCES 2 #define TREEVIEW_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 1 @@ -338,12 +343,12 @@ static void test_callback(void) TVINSERTSTRUCTA ins; TVITEMA tvi; CHAR test_string[] = "Test_string"; + static const CHAR test2A[] = "TEST2"; CHAR buf[128]; LRESULT ret; HWND hTree;
hTree = create_treeview_control(); - fill_tree(hTree);
ret = TreeView_DeleteAllItems(hTree); ok(ret == TRUE, "ret\n"); @@ -396,6 +401,16 @@ static void test_callback(void) ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n", tvi.pszText, TEST_CALLBACK_TEXT);
+ /* notification handler changed A->W */ + g_disp_A_to_W = TRUE; + tvi.hItem = hItem2; + memset(buf, 0, sizeof(buf)); + ret = TreeView_GetItem(hTree, &tvi); + ok(ret == TRUE, "got %ld\n", ret); + ok(strcmp(tvi.pszText, test2A) == 0, "got %s, expected %s\n", + tvi.pszText, test2A); + g_disp_A_to_W = FALSE; + DestroyWindow(hTree); }
@@ -854,10 +869,6 @@ static void test_get_set_unicodeformat(void) DestroyWindow(hTree); }
-static TVITEMA g_item_expanding, g_item_expanded; -static BOOL g_get_from_expand; -static BOOL g_get_rect_in_expand; - static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; @@ -913,6 +924,14 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, if (disp->item.mask & TVIF_TEXT) { lstrcpyn(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax); } + + if (g_disp_A_to_W && (disp->item.mask & TVIF_TEXT)) { + static const WCHAR testW[] = {'T','E','S','T','2',0}; + + disp->hdr.code = TVN_GETDISPINFOW; + memcpy(disp->item.pszText, testW, sizeof(testW)); + } + break; } case TVN_ENDLABELEDIT: return TRUE; diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 1e80c19..f2568d3 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -728,6 +728,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, wineItem->textWidth = 0;
TREEVIEW_SendRealNotify(infoPtr, callback.hdr.idFrom, (LPARAM)&callback); + TRACE("resulting code 0x%08x\n", callback.hdr.code);
/* It may have changed due to a call to SetItem. */ mask &= wineItem->callbackMask; @@ -735,7 +736,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, if ((mask & TVIF_TEXT) && callback.item.pszText != wineItem->pszText) { /* Instead of copying text into our buffer user specified its own */ - if (!infoPtr->bNtfUnicode) { + if (!infoPtr->bNtfUnicode && (callback.hdr.code == TVN_GETDISPINFOA)) { LPWSTR newText; int buflen; int len = MultiByteToWideChar( CP_ACP, 0, @@ -776,7 +777,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, } else if (mask & TVIF_TEXT) { /* User put text into our buffer, that is ok unless A string */ - if (!infoPtr->bNtfUnicode) { + if (!infoPtr->bNtfUnicode && (callback.hdr.code == TVN_GETDISPINFOA)) { LPWSTR newText; LPWSTR oldText = NULL; int buflen;