A test to narrow down the problem from Bug 43465 wrong. Proves my hack I attached there wrong.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/tests/combo.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 03fc412e41..0519ace51c 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -806,11 +806,54 @@ static void test_listbox_size(DWORD style) } }
+void test_WS_VSCROLL(void) +{ + BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO); + HWND hCombo, hList; + COMBOBOXINFO info; + DWORD style; + BOOL ret; + int i; + + pGetComboBoxInfo = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo"); + if (!pGetComboBoxInfo) + { + win_skip("GetComboBoxInfo is not available\n"); + return; + } + info.cbSize = sizeof(info); + hCombo = build_combo(CBS_DROPDOWNLIST); + + SetLastError(0xdeadbeef); + ret = pGetComboBoxInfo(hCombo, &info); + ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError()); + hList = info.hwndList; + + for(i = 0; i < 3; i++) + { + char buffer[2]; + sprintf(buffer, "%d", i); + SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)buffer); + } + + style = GetWindowLongA(info.hwndList, GWL_STYLE); + SetWindowLongA(hList, GWL_STYLE, style | WS_VSCROLL); + + SendMessageA(hCombo, CB_SHOWDROPDOWN, TRUE, 0); + SendMessageA(hCombo, CB_SHOWDROPDOWN, FALSE, 0); + + style = GetWindowLongA(hList, GWL_STYLE); + ok((style & WS_VSCROLL) != 0, "Style does not include WS_VSCROLL\n"); + + DestroyWindow(hCombo); +} + START_TEST(combo) { hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0); ShowWindow(hMainWnd, SW_SHOW);
+ test_WS_VSCROLL(); test_setfont(CBS_DROPDOWN); test_setfont(CBS_DROPDOWNLIST); test_setitemheight(CBS_DROPDOWN);
Some programs seem to be picky about the size they get in WM_NCCALCSIZE. When the scrollbar is visible at the wrong time, that messes up the calculation and leads to its display being permanently broken. Fix that by hiding the scrollbar when the height is 0 and sending a frame-changed notification when showing the dropdown list.
Fixes Bug 43465.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/combo.c | 2 +- dlls/user32/listbox.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index c43d726205..2f270e5db5 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -1063,7 +1063,7 @@ static void CBDropDown( LPHEADCOMBO lphc ) }
SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top, - SWP_NOACTIVATE | SWP_SHOWWINDOW ); + SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_FRAMECHANGED );
if( !(lphc->wState & CBF_NOREDRAW) ) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 6b47f053ae..8f150ae74a 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -234,6 +234,11 @@ static void LISTBOX_UpdateScroll( LB_DESCR *descr ) the programmer use it for his/her own purposes. */
if (descr->style & LBS_NOREDRAW) return; + if (descr->height == 0) + { + ShowScrollBar(descr->self, SB_VERT, FALSE); + return; + } info.cbSize = sizeof(info);
if (descr->style & LBS_MULTICOLUMN)