ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
16 participants
242 discussions
Start a n
N
ew thread
[jimtabor] 54556: [Win32k|User32] - Fix regressions, running RegEdit. Adding more support for scroll bar controls. Pass all but 7 tests including the two wine todos.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Dec 1 12:42:05 2011 New Revision: 54556 URL:
http://svn.reactos.org/svn/reactos?rev=54556&view=rev
Log: [Win32k|User32] - Fix regressions, running RegEdit. Adding more support for scroll bar controls. Pass all but 7 tests including the two wine todos. Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c trunk/reactos/subsystems/win32/win32k/include/userfuncs.h trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] Thu Dec 1 12:42:05 2011 @@ -309,7 +309,7 @@ void IntDrawScrollBar(HWND Wnd, HDC DC, INT Bar) { - //PSBTRACK pSBTrack; + //PSBWND pSBWnd; //INT ThumbSize; SCROLLBARINFO Info; BOOL Vertical; @@ -344,7 +344,7 @@ return; } - //ThumbSize = pSBTrack->pSBCalc->pxThumbBottom - pSBTrack->pSBCalc->pxThumbTop; + //ThumbSize = pSBWnd->pSBCalc->pxThumbBottom - pSBWnd->pSBCalc->pxThumbTop; /* * Draw the arrows. @@ -482,6 +482,11 @@ RECT ClientRect; RECT WindowRect; DWORD Style, ExStyle; + PWND pWnd; + PSBINFO pSBInfo; + + pWnd = ValidateHwnd( Wnd ); + pSBInfo = DesktopPtrToUser(pWnd->pSBInfo); GetClientRect(Wnd, &ClientRect); if (SB_HORZ == Bar || SB_VERT == Bar) @@ -587,12 +592,8 @@ *ThumbSize = GetSystemMetrics(SM_CXVSCROLL); } -#if 0 /* FIXME */ - if (((pixels -= *ThumbSize ) < 0) || - ((info->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH)) -#else - if ((Pixels -= *ThumbSize ) < 0) -#endif + if (((Pixels -= *ThumbSize ) < 0) || + (( pSBInfo->WSBflags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH)) { /* Rectangle too small or scrollbar disabled -> no thumb */ *ThumbPos = *ThumbSize = 0; @@ -1090,13 +1091,13 @@ TRACE("hwnd=%p lpCreate=%p\n", Wnd, lpCreate); -#if 0 /* FIXME */ if (lpCreate->style & WS_DISABLED) - { - info->flags = ESB_DISABLE_BOTH; - TRACE("Created WS_DISABLED scrollbar\n"); - } -#endif + { + // info->flags = ESB_DISABLE_BOTH; + //NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH)); + NtUserMessageCall( Wnd, WM_ENABLE, FALSE, 0, 0, FNID_SCROLLBAR, FALSE); + ERR("Created WS_DISABLED scrollbar\n"); + } if (0 != (lpCreate->style & (SBS_SIZEGRIP | SBS_SIZEBOX))) { @@ -1152,10 +1153,10 @@ ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_POS; - if (! NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo)) - { + if (!NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo)) + { return 0; - } + } return ScrollInfo.nPos; } @@ -1167,10 +1168,10 @@ SCROLLINFO ScrollInfo; if (NULL == MinPos || NULL == MaxPos) - { + { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; - } + } ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_RANGE; @@ -1276,10 +1277,15 @@ case WM_ENABLE: { - TRACE("ScrollBarWndProc WM_ENABLE\n"); - NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH)); - /* Refresh Scrollbars. */ - SCROLL_RefreshScrollBar(Wnd, SB_CTL, TRUE, TRUE); + PWND pWnd = ValidateHwnd(Wnd); + if (pWnd->pSBInfo) + { + ERR("ScrollBarWndProc WM_ENABLE\n"); + //NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH)); + NtUserMessageCall( Wnd, Msg, wParam, lParam, 0, FNID_SCROLLBAR, !unicode); + /* Refresh Scrollbars. */ + SCROLL_RefreshScrollBar(Wnd, SB_CTL, TRUE, TRUE); + } } return 0; @@ -1641,8 +1647,12 @@ INT WINAPI SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw) { + PWND pWnd; INT Result = 0; SCROLLINFO ScrollInfo; + + pWnd = ValidateHwnd(hWnd); + if ( !pWnd || !pWnd->pSBInfo ) return 0; ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_POS; @@ -1652,15 +1662,15 @@ * we will later return. */ if (NtUserSBGetParms(hWnd, nBar, NULL, &ScrollInfo)) - { + { Result = ScrollInfo.nPos; if (Result != nPos) - { + { ScrollInfo.nPos = nPos; /* Finally set the new position */ NtUserSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); - } - } + } + } return Result; } @@ -1671,13 +1681,23 @@ BOOL WINAPI SetScrollRange(HWND hWnd, INT nBar, INT nMinPos, INT nMaxPos, BOOL bRedraw) { + PWND pWnd; SCROLLINFO ScrollInfo; + + pWnd = ValidateHwnd(hWnd); + if ( !pWnd ) return FALSE; + + if ((nMaxPos - nMinPos) > MAXLONG) + { + SetLastError(ERROR_INVALID_SCROLLBAR_RANGE); + return FALSE; + } ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_RANGE; ScrollInfo.nMin = nMinPos; ScrollInfo.nMax = nMaxPos; - NtUserSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); + SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); // do not bypass themes. return TRUE; } Modified: trunk/reactos/subsystems/win32/win32k/include/userfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] Thu Dec 1 12:42:05 2011 @@ -107,6 +107,6 @@ /*************** SCROLLBAR.C ***************/ DWORD FASTCALL -co_UserShowScrollBar(PWND Window, int wBar, DWORD bShow); +co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV); /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Thu Dec 1 12:42:05 2011 @@ -2044,6 +2044,22 @@ switch(dwType) { + case FNID_SCROLLBAR: + { + switch(Msg) + { + case WM_ENABLE: + { + Window = UserGetWindowObject(hWnd); + if (Window->pSBInfo) + { + Window->pSBInfo->WSBflags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH; + } + } + break; + } + break; + } case FNID_DEFWINDOWPROC: /* Validate input */ if (hWnd) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] Thu Dec 1 12:42:05 2011 @@ -400,8 +400,6 @@ else if ((nBar != SB_CTL) && bChangeParams) { action = SA_SSI_HIDE; - //co_UserShowScrollBar(Window, nBar, FALSE); - //return Info->nPos; } } else /* Show and enable scroll-bar only if no page only changed. */ @@ -411,7 +409,6 @@ if ((nBar != SB_CTL) && bChangeParams) { action |= SA_SSI_SHOW; - //co_UserShowScrollBar(Window, nBar, TRUE); } } @@ -425,12 +422,12 @@ done: if ( action & SA_SSI_HIDE ) { - co_UserShowScrollBar(Window, nBar, FALSE); + co_UserShowScrollBar(Window, nBar, FALSE, FALSE); } else { if ( action & SA_SSI_SHOW ) - if ( co_UserShowScrollBar(Window, nBar, TRUE) ) + if ( co_UserShowScrollBar(Window, nBar, TRUE, TRUE) ) return Info->nPos; /* SetWindowPos() already did the painting */ if (bRedraw) { // FIXME: Arrows and interior. @@ -521,6 +518,8 @@ } RtlZeroMemory(Window->pSBInfo, sizeof(SBINFO)); + Window->pSBInfo->Vert.posMax = 100; + Window->pSBInfo->Horz.posMax = 100; co_WinPosGetNonClientSize(Window, &Window->rcWindow, @@ -596,6 +595,62 @@ return Chg; } +/* Ported from WINE20020904 (SCROLL_ShowScrollBar) */ +DWORD FASTCALL +co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV) +{ + ULONG old_style, set_bits = 0, clear_bits = 0; + + ASSERT_REFS_CO(Wnd); + + switch(nBar) + { + case SB_CTL: + { + if (Wnd->pSBInfo) IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o! + + co_WinPosShowWindow(Wnd, fShowH ? SW_SHOW : SW_HIDE); + return TRUE; + } + case SB_BOTH: + case SB_HORZ: + if (fShowH) set_bits |= WS_HSCROLL; + else clear_bits |= WS_HSCROLL; + if( nBar == SB_HORZ ) break; + /* fall through */ + case SB_VERT: + if (fShowV) set_bits |= WS_VSCROLL; + else clear_bits |= WS_VSCROLL; + break; + default: + EngSetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + + old_style = Wnd->style; + Wnd->style = (Wnd->style | set_bits) & ~clear_bits; + + if (fShowH || fShowV) + { + if (!Wnd->pSBInfo) co_IntCreateScrollBars(Wnd); + } + + if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits) + { + ///// Is this needed? Was tested w/o! + if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ); + if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT); + ///// + /* Frame has been changed, let the window redraw itself */ + co_WinPosSetWindowPos(Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | + SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING); + return TRUE; + } + return FALSE; +} + +//// BOOL APIENTRY @@ -642,7 +697,6 @@ END_CLEANUP; } - BOOL APIENTRY @@ -709,6 +763,7 @@ UINT wSBflags, UINT wArrows) { + UINT OrigArrows; PWND Window = NULL; PSCROLLBARINFO InfoV = NULL, InfoH = NULL; BOOL Chg = FALSE; @@ -729,6 +784,7 @@ RETURN( FALSE); } + OrigArrows = Window->pSBInfo->WSBflags; Window->pSBInfo->WSBflags = wArrows; if (wSBflags == SB_CTL) @@ -745,13 +801,6 @@ ERR("Trying to set scrollinfo for unknown scrollbar type %d", wSBflags); RETURN(FALSE); } - - if(!co_IntCreateScrollBars(Window)) - { - RETURN( FALSE); - } - - Window->pSBInfo->WSBflags = wArrows; switch(wSBflags) { @@ -774,10 +823,11 @@ if(InfoH) Chg = (IntEnableScrollBar(TRUE, InfoH, wArrows) || Chg); - ERR("FIXME: EnableScrollBar wSBflags %d wArrows %d\n",wSBflags,wArrows); + ERR("FIXME: EnableScrollBar wSBflags %d wArrows %d Chg %d\n",wSBflags,wArrows, Chg); // Done in user32: // SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); + if (OrigArrows == wArrows) RETURN( FALSE); RETURN( TRUE); CLEANUP: @@ -788,6 +838,81 @@ UserLeave(); END_CLEANUP; } + +DWORD +APIENTRY +NtUserSetScrollInfo( + HWND hWnd, + int fnBar, + LPCSCROLLINFO lpsi, + BOOL bRedraw) +{ + PWND Window = NULL; + NTSTATUS Status; + SCROLLINFO ScrollInfo; + DECLARE_RETURN(DWORD); + USER_REFERENCE_ENTRY Ref; + + TRACE("Enter NtUserSetScrollInfo\n"); + UserEnterExclusive(); + + if(!(Window = UserGetWindowObject(hWnd))) + { + RETURN( 0); + } + UserRefObjectCo(Window, &Ref); + + Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos)); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + RETURN( 0); + } + + RETURN(co_IntSetScrollInfo(Window, fnBar, &ScrollInfo, bRedraw)); + +CLEANUP: + if (Window) + UserDerefObjectCo(Window); + + TRACE("Leave NtUserSetScrollInfo, ret=%i\n",_ret_); + UserLeave(); + END_CLEANUP; + +} + +DWORD APIENTRY +NtUserShowScrollBar(HWND hWnd, int nBar, DWORD bShow) +{ + PWND Window; + DECLARE_RETURN(DWORD); + DWORD ret; + USER_REFERENCE_ENTRY Ref; + + TRACE("Enter NtUserShowScrollBar\n"); + UserEnterExclusive(); + + if (!(Window = UserGetWindowObject(hWnd))) + { + RETURN(0); + } + + UserRefObjectCo(Window, &Ref); + ret = co_UserShowScrollBar(Window, nBar, (nBar == SB_VERT) ? 0 : bShow, + (nBar == SB_HORZ) ? 0 : bShow); + UserDerefObjectCo(Window); + + RETURN(ret); + +CLEANUP: + TRACE("Leave NtUserShowScrollBar, ret%i\n",_ret_); + UserLeave(); + END_CLEANUP; + +} + + +//// Ugly NtUser API //// BOOL APIENTRY @@ -852,134 +977,4 @@ END_CLEANUP; } -DWORD -APIENTRY -NtUserSetScrollInfo( - HWND hWnd, - int fnBar, - LPCSCROLLINFO lpsi, - BOOL bRedraw) -{ - PWND Window = NULL; - NTSTATUS Status; - SCROLLINFO ScrollInfo; - DECLARE_RETURN(DWORD); - USER_REFERENCE_ENTRY Ref; - - TRACE("Enter NtUserSetScrollInfo\n"); - UserEnterExclusive(); - - if(!(Window = UserGetWindowObject(hWnd))) - { - RETURN( 0); - } - UserRefObjectCo(Window, &Ref); - - Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos)); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( 0); - } - - RETURN(co_IntSetScrollInfo(Window, fnBar, &ScrollInfo, bRedraw)); - -CLEANUP: - if (Window) - UserDerefObjectCo(Window); - - TRACE("Leave NtUserSetScrollInfo, ret=%i\n",_ret_); - UserLeave(); - END_CLEANUP; - -} - -/* Ported from WINE20020904 (SCROLL_ShowScrollBar) */ -DWORD FASTCALL -co_UserShowScrollBar(PWND Wnd, int wBar, DWORD bShow) -{ - DWORD Style, OldStyle; - - ASSERT_REFS_CO(Wnd); - - switch(wBar) - { - case SB_HORZ: - Style = WS_HSCROLL; - break; - case SB_VERT: - Style = WS_VSCROLL; - break; - case SB_BOTH: - Style = WS_HSCROLL | WS_VSCROLL; - break; - case SB_CTL: - Style = 0; - break; - default: - EngSetLastError(ERROR_INVALID_PARAMETER); - return( FALSE); - } - - if (wBar == SB_CTL) - { - if (Wnd->pSBInfo) IntUpdateSBInfo(Wnd, SB_CTL); - - co_WinPosShowWindow(Wnd, bShow ? SW_SHOW : SW_HIDE); - return( TRUE); - } - - OldStyle = Wnd->style; - if(bShow) - Wnd->style |= Style; - else - Wnd->style &= ~Style; - - if(Wnd->style != OldStyle) - { - if(Wnd->style & WS_HSCROLL) - IntUpdateSBInfo(Wnd, SB_HORZ); - if(Wnd->style & WS_VSCROLL) - IntUpdateSBInfo(Wnd, SB_VERT); - - if(Wnd->style & WS_VISIBLE) - { - /* Frame has been changed, let the window redraw itself */ - co_WinPosSetWindowPos(Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | - SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING); - } - } - - return( TRUE); -} - - -DWORD APIENTRY -NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow) -{ - PWND Window; - DECLARE_RETURN(DWORD); - DWORD ret; - USER_REFERENCE_ENTRY Ref; - - TRACE("Enter NtUserShowScrollBar\n"); - UserEnterExclusive(); - - if (!(Window = UserGetWindowObject(hWnd))) - { - RETURN(0); - } - - UserRefObjectCo(Window, &Ref); - ret = co_UserShowScrollBar(Window, wBar, bShow); - UserDerefObjectCo(Window); - - RETURN(ret); - -CLEANUP: - TRACE("Leave NtUserShowScrollBar, ret%i\n",_ret_); - UserLeave(); - END_CLEANUP; - -} /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Dec 1 12:42:05 2011 @@ -2148,11 +2148,11 @@ /* Initialize and show the window's scrollbars */ if (Window->style & WS_VSCROLL) { - co_UserShowScrollBar(Window, SB_VERT, TRUE); + co_UserShowScrollBar(Window, SB_VERT, FALSE, TRUE); } if (Window->style & WS_HSCROLL) { - co_UserShowScrollBar(Window, SB_HORZ, TRUE); + co_UserShowScrollBar(Window, SB_HORZ, TRUE, FALSE); } /* Show the new window */
13 years
1
0
0
0
[jimtabor] 54555: [Win32k|User32] - Fix scrollbar class support. Sync ports from wine. Added the window scroll structure to the class. Pass all but 15 tests, two are wine todos lines 304 and 343.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Dec 1 03:20:02 2011 New Revision: 54555 URL:
http://svn.reactos.org/svn/reactos?rev=54555&view=rev
Log: [Win32k|User32] - Fix scrollbar class support. Sync ports from wine. Added the window scroll structure to the class. Pass all but 15 tests, two are wine todos lines 304 and 343. Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/scroll.h trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] Thu Dec 1 03:20:02 2011 @@ -1,5 +1,4 @@ -/* $Id $ - * +/* * ReactOS User32 Library * - ScrollBar control * @@ -80,7 +79,7 @@ CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ ScrollBarWndProcA, /* procA */ ScrollBarWndProcW, /* procW */ - 0, /* extra */ + sizeof(SBWND)-sizeof(WND), /* extra */ IDC_ARROW, /* cursor */ 0 /* brush */ }; @@ -310,6 +309,7 @@ void IntDrawScrollBar(HWND Wnd, HDC DC, INT Bar) { + //PSBTRACK pSBTrack; //INT ThumbSize; SCROLLBARINFO Info; BOOL Vertical; @@ -344,7 +344,7 @@ return; } - //ThumbSize = Info.xyThumbBottom - Info.xyThumbTop; + //ThumbSize = pSBTrack->pSBCalc->pxThumbBottom - pSBTrack->pSBCalc->pxThumbTop; /* * Draw the arrows. @@ -1175,11 +1175,8 @@ ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_RANGE; Result = NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo); - if (Result) - { - *MinPos = ScrollInfo.nMin; - *MaxPos = ScrollInfo.nMax; - } + *MinPos = Result ? ScrollInfo.nMin : 0; + *MaxPos = Result ? ScrollInfo.nMax : 0; return Result; } @@ -1200,13 +1197,11 @@ if (SBType != SB_CTL) { - PWND pwnd = ValidateHwnd(Wnd); - if (!pwnd) return; - XOffset = pwnd->rcClient.left - pwnd->rcWindow.left; - YOffset = pwnd->rcClient.top - pwnd->rcWindow.top; + RECT rect; + GetClientRect(Wnd, &rect); ScreenToClient(Wnd, &Pt); - Pt.x += XOffset; - Pt.y += YOffset; + Pt.x -= rect.left; + Pt.y -= rect.top; } IntScrollHandleScrollEvent(Wnd, SBType, WM_LBUTTONDOWN, Pt); @@ -1241,7 +1236,7 @@ * ScrollBarWndProc */ LRESULT WINAPI -ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) +ScrollBarWndProc_common(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) { #ifdef __REACTOS__ // Do this now, remove after Server side is fixed. PWND pWnd; @@ -1279,26 +1274,14 @@ IntScrollCreateScrollBar(Wnd, (LPCREATESTRUCTW) lParam); break; -//#if 0 /* FIXME */ case WM_ENABLE: { -// SCROLLBAR_INFO *infoPtr; -// if ((infoPtr = SCROLL_GetScrollBarInfo( hwnd, SB_CTL ))) -// { -// infoPtr->flags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH; -// SCROLL_RefreshScrollBar(hwnd, SB_CTL, TRUE, TRUE); -// } - HDC hdc; - DbgPrint("ScrollBarWndProc WM_ENABLE\n"); + TRACE("ScrollBarWndProc WM_ENABLE\n"); NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH)); /* Refresh Scrollbars. */ - hdc = GetDCEx( Wnd, 0, DCX_CACHE ); - if (!hdc) return 1; - IntDrawScrollBar( Wnd, hdc, SB_CTL); - ReleaseDC( Wnd, hdc ); + SCROLL_RefreshScrollBar(Wnd, SB_CTL, TRUE, TRUE); } return 0; -//#endif case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: @@ -1430,9 +1413,9 @@ case SBM_GETRANGE: return IntScrollGetScrollRange(Wnd, SB_CTL, (LPINT) wParam, (LPINT) lParam); - + case SBM_ENABLE_ARROWS: - return EnableScrollBar(Wnd, SB_CTL, wParam); + return EnableScrollBar( Wnd, SB_CTL, wParam ); case SBM_SETSCROLLINFO: return NtUserSetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam); @@ -1460,7 +1443,10 @@ { WARN("unknown msg %04x wp=%04lx lp=%08lx\n", Msg, wParam, lParam); } - return DefWindowProc(Wnd, Msg, wParam, lParam ); + if (unicode) + return DefWindowProcW( Wnd, Msg, wParam, lParam ); + else + return DefWindowProcA( Wnd, Msg, wParam, lParam ); } return 0; @@ -1469,13 +1455,13 @@ LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - return ScrollBarWndProc(DefWindowProcW, Wnd, Msg, wParam, lParam); + return ScrollBarWndProc_common(DefWindowProcW, Wnd, Msg, wParam, lParam, TRUE); } LRESULT WINAPI ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - return ScrollBarWndProc(DefWindowProcA, Wnd, Msg, wParam, lParam); + return ScrollBarWndProc_common(DefWindowProcA, Wnd, Msg, wParam, lParam, FALSE); } @@ -1493,8 +1479,14 @@ Hook = BeginIfHookedUserApiHook(); /* Bypass SEH and go direct. */ - if (!Hook) return NtUserEnableScrollBar(hwnd, nBar, flags); - + if (!Hook) + { + Ret = NtUserEnableScrollBar(hwnd, nBar, flags); + if (GetLastError() == ERROR_INVALID_PARAMETER) return Ret; + if (nBar == SB_CTL) return Ret; + SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); + return Ret; + } _SEH2_TRY { Ret = guah.EnableScrollBar(hwnd, nBar, flags); Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Dec 1 03:20:02 2011 @@ -396,6 +396,26 @@ SBDATA Horz; SBDATA Vert; } SBINFO, *PSBINFO; + +typedef struct tagSBCALC +{ + INT posMin; + INT posMax; + INT page; + INT pos; + INT pxTop; + INT pxBottom; + INT pxLeft; + INT pxRight; + INT cpxThumb; + INT pxUpArrow; + INT pxDownArrow; + INT pxStart; + INT pxThumbBottom; + INT pxThumbTop; + INT cpx; + INT pxMin; +} SBCALC, *PSBCALC; typedef enum _GETCPD { @@ -615,6 +635,14 @@ /* Entry in the list of thread windows. */ LIST_ENTRY ThreadListEntry; } WND, *PWND; + +typedef struct _SBWND +{ + WND wnd; + BOOL fVert; + UINT wDisableFlags; + SBCALC SBCalc; +} SBWND, *PSBWND; typedef struct _PFNCLIENT { Modified: trunk/reactos/subsystems/win32/win32k/include/scroll.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/scroll.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/scroll.h [iso-8859-1] Thu Dec 1 03:20:02 2011 @@ -1,24 +1,4 @@ #pragma once - -typedef struct tagSBCALC -{ - INT posMin; - INT posMax; - INT page; - INT pos; - INT pxTop; - INT pxBottom; - INT pxLeft; - INT pxRight; - INT cpxThumb; - INT pxUpArrow; - INT pxDownArrow; - INT pxStart; - INT pxThumbBottom; - INT pxThumbTop; - INT cpx; - INT pxMin; -} SBCALC, *PSBCALC; typedef VOID (NEAR NTAPI *PFN_SCROLLBAR)(PWND, UINT, WPARAM, LPARAM, PSBCALC); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Thu Dec 1 03:20:02 2011 @@ -41,7 +41,7 @@ { L"ScrollBar", CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW|CS_PARENTDC, NULL, // Use User32 procs - 0, + sizeof(SBWND)-sizeof(WND), IDC_ARROW, NULL, FNID_SCROLLBAR, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] Thu Dec 1 03:20:02 2011 @@ -12,6 +12,12 @@ #define MINTRACKTHUMB 8 /* Minimum size of the rectangle between the arrows */ + /* What to do after SetScrollInfo() */ + #define SA_SSI_HIDE 0x0001 + #define SA_SSI_SHOW 0x0002 + #define SA_SSI_REFRESH 0x0004 + #define SA_SSI_REPAINT_ARROWS 0x0008 + #define SBRG_SCROLLBAR 0 /* the scrollbar itself */ #define SBRG_TOPRIGHTBTN 1 /* the top or right button */ #define SBRG_PAGEUPRIGHT 2 /* the page up or page right region */ @@ -160,6 +166,7 @@ LPSCROLLINFO psi; ASSERT(Window); + ASSERT(Window->pSBInfo); ASSERT(Window->pSBInfoex); sbi = IntGetScrollbarInfoFromWindow(Window, wBar); @@ -183,10 +190,7 @@ return FALSE; } - if(!co_IntCreateScrollBars(Window)) - { - return FALSE; - } + if (!Window->pSBInfo) return FALSE; psi = IntGetScrollInfoFromWindow(Window, nBar); @@ -239,6 +243,8 @@ ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar); return FALSE; } + + if (!pWnd->pSBInfo || !pSBTrack) return FALSE; Mask = lpsi->fMask; @@ -280,7 +286,8 @@ LPSCROLLINFO Info; PSCROLLBARINFO psbi; - /* UINT new_flags;*/ + UINT new_flags; + INT action = 0; BOOL bChangeParams = FALSE; /* don't show/hide scrollbar if params don't change */ ASSERT_REFS_CO(Window); @@ -313,7 +320,7 @@ Info = IntGetScrollInfoFromWindow(Window, nBar); /* Set the page size */ - if (0 != (lpsi->fMask & SIF_PAGE)) + if (lpsi->fMask & SIF_PAGE) { if (Info->nPage != lpsi->nPage) { @@ -323,20 +330,21 @@ } /* Set the scroll pos */ - if (0 != (lpsi->fMask & SIF_POS)) + if (lpsi->fMask & SIF_POS) { if (Info->nPos != lpsi->nPos) { Info->nPos = lpsi->nPos; + bChangeParams = TRUE; } } /* Set the scroll range */ - if (0 != (lpsi->fMask & SIF_RANGE)) + if (lpsi->fMask & SIF_RANGE) { /* Invalid range -> range is set to (0,0) */ - if (lpsi->nMin > lpsi->nMax || - 0x80000000 <= (UINT)(lpsi->nMax - lpsi->nMin)) + if ((lpsi->nMin > lpsi->nMax) || + ((UINT)(lpsi->nMax - lpsi->nMin) >= 0x80000000)) { Info->nMin = 0; Info->nMax = 0; @@ -351,7 +359,9 @@ } /* Make sure the page size is valid */ - if (Info->nMax - Info->nMin + 1 < Info->nPage) + if (Info->nPage < 0) + Info->nPage = 0; + else if (Info->nMax - Info->nMin + 1 < Info->nPage) { Info->nPage = Info->nMax - Info->nMin + 1; } @@ -370,56 +380,77 @@ * Don't change the scrollbar state if SetScrollInfo is just called * with SIF_DISABLENOSCROLL */ - if (0 == (lpsi->fMask & SIF_ALL)) - { - return Info->nPos; + if (!(lpsi->fMask & SIF_ALL)) + { + goto done; //return Info->nPos; } /* Check if the scrollbar should be hidden or disabled */ - if (0 != (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))) - { + if (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL)) + { + new_flags = Window->pSBInfo->WSBflags; if (Info->nMin >= (int)(Info->nMax - max(Info->nPage - 1, 0))) { /* Hide or disable scroll-bar */ - if (0 != (lpsi->fMask & SIF_DISABLENOSCROLL)) - { - /* new_flags = ESB_DISABLE_BOTH;*/ + if (lpsi->fMask & SIF_DISABLENOSCROLL) + { + new_flags = ESB_DISABLE_BOTH; + bChangeParams = TRUE; } else if ((nBar != SB_CTL) && bChangeParams) { - co_UserShowScrollBar(Window, nBar, FALSE); - return Info->nPos; - } - } - else /* Show and enable scroll-bar */ - { - /* new_flags = 0;*/ + action = SA_SSI_HIDE; + //co_UserShowScrollBar(Window, nBar, FALSE); + //return Info->nPos; + } + } + else /* Show and enable scroll-bar only if no page only changed. */ + if (lpsi->fMask != SIF_PAGE) + { + new_flags = ESB_ENABLE_BOTH; if ((nBar != SB_CTL) && bChangeParams) { - co_UserShowScrollBar(Window, nBar, TRUE); - } - } - -#if 0 - if (infoPtr->flags != new_flags) /* check arrow flags */ - { - infoPtr->flags = new_flags; - *Action |= SA_SSI_REPAINT_ARROWS; - } -#endif - - } - - if (bRedraw) - { - RECTL UpdateRect = psbi->rcScrollBar; - UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; - UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left; - UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top; - UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; - co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); - } - + action |= SA_SSI_SHOW; + //co_UserShowScrollBar(Window, nBar, TRUE); + } + } + + if (Window->pSBInfo->WSBflags != new_flags) /* check arrow flags */ + { + Window->pSBInfo->WSBflags = new_flags; + action |= SA_SSI_REPAINT_ARROWS; + } + } + +done: + if ( action & SA_SSI_HIDE ) + { + co_UserShowScrollBar(Window, nBar, FALSE); + } + else + { + if ( action & SA_SSI_SHOW ) + if ( co_UserShowScrollBar(Window, nBar, TRUE) ) + return Info->nPos; /* SetWindowPos() already did the painting */ + if (bRedraw) + { // FIXME: Arrows and interior. + RECTL UpdateRect = psbi->rcScrollBar; + UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top; + UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; + co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); + } // FIXME: Arrows + else if( action & SA_SSI_REPAINT_ARROWS ) + { + RECTL UpdateRect = psbi->rcScrollBar; + UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left; + UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top; + UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; + co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); + } + } /* Return current position */ return Info->nPos; } @@ -430,7 +461,6 @@ INT Bar; PSCROLLBARINFO sbi; LPSCROLLINFO psi; - ASSERT_REFS_CO(Window); Bar = SBOBJ_TO_SBID(idObject); @@ -468,7 +498,7 @@ ASSERT_REFS_CO(Window); - if(Window->pSBInfoex) + if (Window->pSBInfo && Window->pSBInfoex) { /* no need to create it anymore */ return TRUE; @@ -483,6 +513,14 @@ } RtlZeroMemory(Window->pSBInfoex, Size); + + if(!(Window->pSBInfo = DesktopHeapAlloc( Window->head.rpdesk, sizeof(SBINFO)))) + { + ERR("Unable to allocate memory for scrollbar information for window 0x%x\n", Window->head.h); + return FALSE; + } + + RtlZeroMemory(Window->pSBInfo, sizeof(SBINFO)); co_WinPosGetNonClientSize(Window, &Window->rcWindow, @@ -509,8 +547,10 @@ BOOL FASTCALL IntDestroyScrollBars(PWND Window) { - if(Window->pSBInfoex) - { + if (Window->pSBInfo && Window->pSBInfoex) + { + DesktopHeapFree(Window->head.rpdesk, Window->pSBInfo); + Window->pSBInfo = NULL; ExFreePool(Window->pSBInfoex); Window->pSBInfoex = NULL; return TRUE; @@ -662,7 +702,6 @@ END_CLEANUP; } - BOOL APIENTRY NtUserEnableScrollBar( @@ -679,19 +718,23 @@ TRACE("Enter NtUserEnableScrollBar\n"); UserEnterExclusive(); - if(!(Window = UserGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { RETURN(FALSE); } UserRefObjectCo(Window, &Ref); - if(wSBflags == SB_CTL) - { - /* FIXME Enable or Disable SB Ctrl*/ - ERR("Enable Scrollbar SB_CTL\n"); - InfoV = IntGetScrollbarInfoFromWindow(Window, SB_CTL); - Chg = IntEnableScrollBar(FALSE, InfoV ,wArrows); - /* Chg? Scrollbar is Refresh in user32/controls/scrollbar.c. */ + if (!co_IntCreateScrollBars(Window)) + { + RETURN( FALSE); + } + + Window->pSBInfo->WSBflags = wArrows; + + if (wSBflags == SB_CTL) + { + if ((wArrows == ESB_DISABLE_BOTH || wArrows == ESB_ENABLE_BOTH)) + IntEnableWindow(hWnd, (wArrows == ESB_ENABLE_BOTH)); RETURN(TRUE); } @@ -707,6 +750,8 @@ { RETURN( FALSE); } + + Window->pSBInfo->WSBflags = wArrows; switch(wSBflags) { @@ -728,10 +773,11 @@ if(InfoH) Chg = (IntEnableScrollBar(TRUE, InfoH, wArrows) || Chg); - - //if(Chg && (Window->style & WS_VISIBLE)) - /* FIXME - repaint scrollbars */ - + + ERR("FIXME: EnableScrollBar wSBflags %d wArrows %d\n",wSBflags,wArrows); +// Done in user32: +// SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); + RETURN( TRUE); CLEANUP: @@ -875,14 +921,9 @@ return( FALSE); } - if(!co_IntCreateScrollBars(Wnd)) - { - return( FALSE); - } - if (wBar == SB_CTL) { - IntUpdateSBInfo(Wnd, SB_CTL); + if (Wnd->pSBInfo) IntUpdateSBInfo(Wnd, SB_CTL); co_WinPosShowWindow(Wnd, bShow ? SW_SHOW : SW_HIDE); return( TRUE);
13 years
1
0
0
0
← Newer
1
...
22
23
24
25
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Results per page:
10
25
50
100
200