diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 5556315..7b7818b 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -1237,6 +1237,7 @@ static BOOL SCROLL_GetScrollBarInfo(HWND hwnd, LONG idObject, LPSCROLLBARINFO in INT nDummy; DWORD style = GetWindowLongW(hwnd, GWL_STYLE); BOOL pressed; + RECT rect; switch (idObject) { @@ -1252,6 +1253,9 @@ static BOOL SCROLL_GetScrollBarInfo(HWND hwnd, LONG idObject, LPSCROLLBARINFO in SCROLL_GetScrollBarRect(hwnd, nBar, &info->rcScrollBar, &nDummy, &info->dxyLineButton, &info->xyThumbTop); + /* rcScrollBar needs to be in screen coordinates */ + GetWindowRect(hwnd, &rect); + OffsetRect(&info->rcScrollBar, rect.left, rect.top); info->xyThumbBottom = info->xyThumbTop + info->dxyLineButton; diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c index 3bc407a..5c61f65 100644 --- a/dlls/user32/tests/scroll.c +++ b/dlls/user32/tests/scroll.c @@ -127,6 +127,28 @@ static void scrollbar_test3(void) } +static void scrollbar_test4(void) +{ + BOOL ret; + SCROLLBARINFO sbi; + RECT rect; + + /* Test GetScrollBarInfo to make sure it returns rcScrollBar in screen + * coordinates. */ + sbi.cbSize = sizeof(sbi); + ret = GetScrollBarInfo( hScroll, OBJID_CLIENT, &sbi); + ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); + GetWindowRect( hScroll, &rect ); + ok( ret, "The GetWindowRect() call should not fail.\n" ); + ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)), + "unexpected rgstate(0x%x)\n", sbi.rgstate[0]); + ok( !memcmp(&rect, &sbi.rcScrollBar, sizeof(RECT)), + "WindowRect(%d, %d, %d, %d) != rcScrollBar(%d, %d, %d, %d)\n", + rect.top, rect.left, rect.bottom, rect.right, + sbi.rcScrollBar.top, sbi.rcScrollBar.left, + sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); +} + START_TEST ( scroll ) { WNDCLASSA wc; @@ -154,6 +176,7 @@ START_TEST ( scroll ) scrollbar_test1(); scrollbar_test2(); scrollbar_test3(); + scrollbar_test4(); DestroyWindow(hScroll); DestroyWindow(hMainWnd);