Fix scrollbar controls

svn path=/trunk/; revision=9357
This commit is contained in:
Gé van Geldorp 2004-05-12 09:47:16 +00:00
parent 45ac874e11
commit a218ec6e0b
3 changed files with 32 additions and 31 deletions

View file

@ -88,7 +88,7 @@ const struct builtin_class_descr SCROLL_builtin_class =
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
ScrollBarWndProc, /* procW */ ScrollBarWndProc, /* procW */
NULL, /* procA (winproc is Unicode only) */ NULL, /* procA (winproc is Unicode only) */
sizeof(SCROLLBARINFO) + sizeof(SCROLLINFO), /* extra */ 0, /* extra */
IDC_ARROW, /* cursor */ IDC_ARROW, /* cursor */
0 /* brush */ 0 /* brush */
}; };
@ -1422,7 +1422,7 @@ ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
return 0; return 0;
case SBM_SETSCROLLINFO: case SBM_SETSCROLLINFO:
return SetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam); return NtUserSetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam);
case SBM_GETSCROLLINFO: case SBM_GETSCROLLINFO:
return NtUserGetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam); return NtUserGetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam);
@ -1475,9 +1475,16 @@ GetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO lpsi) GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
{ {
return NtUserGetScrollInfo(Wnd, SBType, lpsi); if (SB_CTL == SBType)
{
return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info);
}
else
{
return NtUserGetScrollInfo(Wnd, SBType, Info);
}
} }
/* /*
@ -1522,9 +1529,16 @@ GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos)
* @implemented * @implemented
*/ */
INT STDCALL INT STDCALL
SetScrollInfo(HWND hWnd, int nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
{ {
return NtUserSetScrollInfo(hWnd, nBar, lpsi, bRedraw); if (SB_CTL == SBType)
{
return SendMessageW(Wnd, SBM_SETSCROLLINFO, (WPARAM) bRedraw, (LPARAM) Info);
}
else
{
return NtUserSetScrollInfo(Wnd, SBType, Info, bRedraw);
}
} }
/* /*

View file

@ -14,7 +14,7 @@ typedef struct _WINDOW_SCROLLINFO
((LPSCROLLINFO)(&((Window)->Scroll + i)->ScrollInfo)) ((LPSCROLLINFO)(&((Window)->Scroll + i)->ScrollInfo))
#define SBOBJ_TO_SBID(Obj) ((Obj) - OBJID_HSCROLL) #define SBOBJ_TO_SBID(Obj) ((Obj) - OBJID_HSCROLL)
#define SBID_IS_VAILD(id) (id == SB_HORZ || id == SB_VERT) #define SBID_IS_VALID(id) (id == SB_HORZ || id == SB_VERT || id == SB_CTL)
BOOL FASTCALL IntCreateScrollBars(PWINDOW_OBJECT Window); BOOL FASTCALL IntCreateScrollBars(PWINDOW_OBJECT Window);
BOOL FASTCALL IntDestroyScrollBars(PWINDOW_OBJECT Window); BOOL FASTCALL IntDestroyScrollBars(PWINDOW_OBJECT Window);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: scrollbar.c,v 1.32 2004/05/10 17:07:18 weiden Exp $ /* $Id: scrollbar.c,v 1.33 2004/05/12 09:47:16 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -203,10 +203,10 @@ IntGetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPSCROLLINFO lpsi)
UINT Mask; UINT Mask;
LPSCROLLINFO psi; LPSCROLLINFO psi;
if(!SBID_IS_VAILD(nBar)) if(!SBID_IS_VALID(nBar))
{ {
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d", nBar); DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
return FALSE; return FALSE;
} }
@ -263,7 +263,7 @@ IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedr
/* UINT new_flags;*/ /* UINT new_flags;*/
BOOL bChangeParams = FALSE; /* don't show/hide scrollbar if params don't change */ BOOL bChangeParams = FALSE; /* don't show/hide scrollbar if params don't change */
if(!SBID_IS_VAILD(nBar)) if(!SBID_IS_VALID(nBar))
{ {
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
DPRINT1("Trying to set scrollinfo for unknown scrollbar type %d", nBar); DPRINT1("Trying to set scrollinfo for unknown scrollbar type %d", nBar);
@ -414,10 +414,10 @@ IntGetScrollBarInfo(PWINDOW_OBJECT Window, LONG idObject, PSCROLLBARINFO psbi)
Bar = SBOBJ_TO_SBID(idObject); Bar = SBOBJ_TO_SBID(idObject);
if(!SBID_IS_VAILD(Bar)) if(!SBID_IS_VALID(Bar))
{ {
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d", Bar); DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
return FALSE; return FALSE;
} }
@ -453,7 +453,7 @@ IntCreateScrollBars(PWINDOW_OBJECT Window)
} }
/* allocate memory for all scrollbars (HORZ, VERT, CONTROL) */ /* allocate memory for all scrollbars (HORZ, VERT, CONTROL) */
Size = 2 * (sizeof(WINDOW_SCROLLINFO)); Size = 3 * (sizeof(WINDOW_SCROLLINFO));
if(!(Window->Scroll = ExAllocatePoolWithTag(PagedPool, Size, TAG_SBARINFO))) if(!(Window->Scroll = ExAllocatePoolWithTag(PagedPool, Size, TAG_SBARINFO)))
{ {
DPRINT1("Unable to allocate memory for scrollbar information for window 0x%x\n", Window->Self); DPRINT1("Unable to allocate memory for scrollbar information for window 0x%x\n", Window->Self);
@ -605,13 +605,7 @@ NtUserGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
return FALSE; return FALSE;
} }
if(fnBar == SB_CTL) Ret = IntGetScrollInfo(Window, fnBar, &psi);
{
IntSendMessage(Window->Self, SBM_GETSCROLLINFO, 0, (LPARAM)lpsi);
Ret = TRUE;
}
else
Ret = IntGetScrollInfo(Window, fnBar, &psi);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
@ -652,7 +646,7 @@ NtUserEnableScrollBar(
return FALSE; return FALSE;
} }
if(wSBflags != SB_BOTH && !SBID_IS_VAILD(wSBflags)) if(wSBflags != SB_BOTH && !SBID_IS_VALID(wSBflags))
{ {
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
@ -718,7 +712,7 @@ NtUserSetScrollBarInfo(
} }
Obj = SBOBJ_TO_SBID(idObject); Obj = SBOBJ_TO_SBID(idObject);
if(!SBID_IS_VAILD(Obj)) if(!SBID_IS_VALID(Obj))
{ {
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
@ -772,13 +766,6 @@ NtUserSetScrollInfo(
return 0; return 0;
} }
if(fnBar == SB_CTL)
{
Ret = IntSendMessage(hwnd, SBM_SETSCROLLINFO, (WPARAM)bRedraw, (LPARAM)lpsi);
IntReleaseWindowObject(Window);
return Ret;
}
Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos)); Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos));
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {