Module: wine Branch: master Commit: 379cf468734363da9c5aa60dec23702ae478a4a5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=379cf468734363da9c5aa60dec...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Apr 23 22:39:55 2010 +0400
comctl32/listview: Don't change Z-order of edit window while resizing edit box.
---
dlls/comctl32/listview.c | 14 ++++---------- dlls/comctl32/tests/listview.c | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 256d4c6..09c731a 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -11599,7 +11599,7 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP
/* Select font to get the right dimension of the string */ hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0); - if(hFont != 0) + if (hFont) { hOldFont = SelectObject(hdc, hFont); } @@ -11612,16 +11612,10 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP GetTextMetricsW(hdc, &textMetric); sz.cx += (textMetric.tmMaxCharWidth * 2);
- SetWindowPos ( - infoPtr->hwndEdit, - HWND_TOP, - 0, - 0, - sz.cx, - rect.bottom - rect.top, - SWP_DRAWFRAME|SWP_NOMOVE); + SetWindowPos(infoPtr->hwndEdit, NULL, 0, 0, sz.cx, + rect.bottom - rect.top, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOZORDER); } - if(hFont != 0) + if (hFont) SelectObject(hdc, hOldFont);
ReleaseDC(infoPtr->hwndEdit, hdc); diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 4bf877a..176f323 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -3422,12 +3422,12 @@ static void test_getitemrect(void)
static void test_editbox(void) { - HWND hwnd, hwndedit, hwndedit2; + static CHAR testitemA[] = "testitem"; + static CHAR testitem1A[] = "testitem_quitelongname"; + static CHAR buffer[25]; + HWND hwnd, hwndedit, hwndedit2, header; LVITEMA item; DWORD r; - static CHAR testitemA[] = "testitem"; - static CHAR testitem1A[] = "testitem1"; - static CHAR buffer[10];
hwnd = create_listview_control(LVS_EDITLABELS | LVS_REPORT); ok(hwnd != NULL, "failed to create a listview window\n"); @@ -3447,16 +3447,28 @@ static void test_editbox(void) hwndedit = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0); ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
+ /* test children Z-order after Edit box created */ + header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0); + ok(IsWindow(header), "Expected header to be created\n"); + ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n"); + ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT)); + /* modify initial string */ r = SendMessage(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A); expect(TRUE, r); + + /* edit window is resized and repositioned, + check again for Z-order - it should be preserved */ + ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n"); + ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT)); + /* return focus to listview */ SetFocus(hwnd);
memset(&item, 0, sizeof(item)); item.mask = LVIF_TEXT; item.pszText = buffer; - item.cchTextMax = 10; + item.cchTextMax = sizeof(buffer); item.iItem = 0; item.iSubItem = 0; r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM)&item); @@ -3496,7 +3508,7 @@ static void test_editbox(void) expect(0, r); memset(&item, 0, sizeof(item)); item.pszText = buffer; - item.cchTextMax = 10; + item.cchTextMax = sizeof(buffer); item.iItem = 0; item.iSubItem = 0; r = SendMessage(hwnd, LVM_GETITEMTEXTA, 0, (LPARAM)&item); @@ -3522,7 +3534,7 @@ static void test_editbox(void)
memset(&item, 0, sizeof(item)); item.pszText = buffer; - item.cchTextMax = 10; + item.cchTextMax = sizeof(buffer); item.iItem = 0; item.iSubItem = 0; r = SendMessage(hwnd, LVM_GETITEMTEXTA, 0, (LPARAM)&item);