user32: Attempt to set scroll info in SetScrollPos even if SCROLL_GetInternalInfo fails.
SetScrollPos may be called on non-scroll window and we should send SBM_SETSCROLLINFO. This fixes scrollbars in Visio. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
db4fc7a1f5
commit
9d4ce95de5
|
@ -1854,10 +1854,9 @@ INT WINAPI DECLSPEC_HOTPATCH SetScrollPos( HWND hwnd, INT nBar, INT nPos, BOOL b
|
|||
{
|
||||
SCROLLINFO info;
|
||||
SCROLLBAR_INFO *infoPtr;
|
||||
INT oldPos;
|
||||
INT oldPos = 0;
|
||||
|
||||
if (!(infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, FALSE ))) return 0;
|
||||
oldPos = infoPtr->curVal;
|
||||
if ((infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, FALSE ))) oldPos = infoPtr->curVal;
|
||||
info.cbSize = sizeof(info);
|
||||
info.nPos = nPos;
|
||||
info.fMask = SIF_POS;
|
||||
|
|
|
@ -604,11 +604,16 @@ static void test_SetScrollInfo(void)
|
|||
|
||||
static WNDPROC scrollbar_wndproc;
|
||||
|
||||
static SCROLLINFO set_scrollinfo;
|
||||
|
||||
static LRESULT CALLBACK subclass_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
if (msg == WM_CREATE && ((CREATESTRUCTA*)lparam)->lpCreateParams)
|
||||
return DefWindowProcA(hwnd, msg, wparam, lparam);
|
||||
|
||||
if (msg == SBM_SETSCROLLINFO)
|
||||
set_scrollinfo = *(SCROLLINFO*)lparam;
|
||||
|
||||
return CallWindowProcA(scrollbar_wndproc, hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
||||
|
@ -637,6 +642,20 @@ static void test_subclass(void)
|
|||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
|
||||
r = SetScrollRange(hwnd, SB_CTL, 0, 100, TRUE);
|
||||
ok(r, "SetScrollRange failed: %u\n", GetLastError());
|
||||
|
||||
res = SetScrollPos(hwnd, SB_CTL, 2, FALSE);
|
||||
ok(!res, "SetScrollPos returned %lu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 2, "SetScrollPos returned %lu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
|
@ -671,6 +690,14 @@ static void test_subclass(void)
|
|||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 0, "SetScrollPos returned %lu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue