Module: wine Branch: master Commit: 55ff2549860315622e265e9eb7b3c8faeb84b481 URL: http://source.winehq.org/git/wine.git/?a=commit;h=55ff2549860315622e265e9eb7...
Author: Christian Costa titan.costa@gmail.com Date: Sun Sep 23 20:46:31 2012 +0200
comctl32: Invalid format returned by NF_QUERY defaults to ANSI in treeview.
---
dlls/comctl32/tests/treeview.c | 13 ++++++++++++- dlls/comctl32/treeview.c | 9 ++++----- 2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index 5a4fde3..baf0e02 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -956,6 +956,10 @@ static void test_get_set_unicodeformat(void) hTree = create_treeview_control(0); fill_tree(hTree);
+ /* Check that an invalid format returned by NF_QUERY defaults to ANSI */ + bPreviousSetting = (BOOL)SendMessage( hTree, TVM_GETUNICODEFORMAT, 0, 0 ); + ok(bPreviousSetting == 0, "Format should be ANSI.\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set to Unicode */ @@ -1007,10 +1011,17 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, }
switch(message) { + case WM_NOTIFYFORMAT: + { + /* Make NF_QUERY return an invalid format to show that it defaults to ANSI */ + if (lParam == NF_QUERY) return 0; + break; + } + case WM_NOTIFY: { NMHDR *pHdr = (NMHDR *)lParam; - + ok(pHdr->code != NM_TOOLTIPSCREATED, "Treeview should not send NM_TOOLTIPSCREATED\n"); if (pHdr->idFrom == 100) { diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index d8fe635..7d195a0 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -848,7 +848,9 @@ static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nC format = SendMessageW(hwndFrom, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwnd, NF_QUERY); TRACE("format=%d\n", format);
- if (format != NFR_ANSI && format != NFR_UNICODE) return 0; + /* Invalid format returned by NF_QUERY defaults to ANSI*/ + if (format != NFR_ANSI && format != NFR_UNICODE) + format = NFR_ANSI;
infoPtr->bNtfUnicode = (format == NFR_UNICODE);
@@ -5067,10 +5069,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->hwndToolTip = 0;
- infoPtr->bNtfUnicode = IsWindowUnicode (hwnd); - - /* Determine what type of notify should be issued */ - /* sets infoPtr->bNtfUnicode */ + /* Determine what type of notify should be issued (sets infoPtr->bNtfUnicode) */ TREEVIEW_NotifyFormat(infoPtr, infoPtr->hwndNotify, NF_REQUERY);
if (!(infoPtr->dwStyle & TVS_NOTOOLTIPS))