win32u: Support undocumented SIF_RETURNPREV flag in set_scroll_info.

This commit is contained in:
Jacek Caban 2022-07-03 23:31:45 +02:00 committed by Alexandre Julliard
parent f059013a41
commit c9c69dff7e
3 changed files with 22 additions and 3 deletions

View file

@ -671,6 +671,19 @@ static void test_SetScrollInfo(void)
ret = IsWindowEnabled(hScroll);
ok(ret, "Unexpected enabled state.\n");
EnableScrollBar(mainwnd, SB_CTL, ESB_ENABLE_BOTH);
si.fMask = SIF_POS;
si.nPos = 3;
ret = SetScrollInfo(mainwnd, SB_HORZ, &si, FALSE);
ok(ret == 3, "SetScrollInfo returned %d\n", ret);
/* undocumented flag making SetScrollInfo return previous position */
si.fMask = SIF_POS | 0x1000;
si.nPos = 4;
ret = SetScrollInfo(mainwnd, SB_HORZ, &si, FALSE);
ok(ret == 3, "SetScrollInfo returned %d\n", ret);
DestroyWindow(hScroll);
DestroyWindow(mainwnd);
}

View file

@ -824,7 +824,7 @@ void track_scroll_bar( HWND hwnd, int scrollbar, POINT pt )
*/
static inline BOOL validate_scroll_info( const SCROLLINFO *info )
{
return !(info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL) ||
return !(info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL | SIF_RETURNPREV) ||
(info->cbSize != sizeof(*info) &&
info->cbSize != sizeof(*info) - sizeof(info->nTrackPos)));
}
@ -862,7 +862,7 @@ static int set_scroll_info( HWND hwnd, int bar, const SCROLLINFO *info, BOOL red
{
struct scroll_info *scroll;
UINT new_flags;
int action = 0, ret;
int action = 0, ret = 0;
/* handle invalid data structure */
if (!validate_scroll_info( info ) ||
@ -878,6 +878,9 @@ static int set_scroll_info( HWND hwnd, int bar, const SCROLLINFO *info, BOOL red
TRACE( "\n" );
}
/* undocumented flag, return previous position instead of modified */
if (info->fMask & SIF_RETURNPREV) ret = scroll->curVal;
/* Set the page size */
if ((info->fMask & SIF_PAGE) && scroll->page != info->nPage)
{
@ -970,7 +973,7 @@ static int set_scroll_info( HWND hwnd, int bar, const SCROLLINFO *info, BOOL red
}
done:
ret = scroll->curVal;
if (!(info->fMask & SIF_RETURNPREV)) ret = scroll->curVal;
release_scroll_info_ptr( scroll );
if (action & SA_SSI_HIDE)
show_scroll_bar( hwnd, bar, FALSE, FALSE );

View file

@ -269,6 +269,9 @@ struct send_message_callback_params
/* NtUserScrollWindowEx flag */
#define SW_NODCCACHE 0x8000
/* NtUserSetScrollInfo flag */
#define SIF_RETURNPREV 0x1000
/* NtUserInitializeClientPfnArrays parameter, not compatible with Windows */
struct user_client_procs
{