2 * Undocumented SmoothScrollWindow function from COMCTL32.DLL
4 * Copyright 2000 Marcus Meissner <marcus@jet.franken.de>
7 * - actually add smooth scrolling
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(commctrl);
18 static DWORD smoothscroll = 2;
20 typedef BOOL CALLBACK (*SCROLLWINDOWEXPROC)(HWND,INT,INT,LPRECT,LPRECT,HRGN,LPRECT,DWORD);
21 typedef struct tagSMOOTHSCROLLSTRUCT {
38 SCROLLWINDOWEXPROC scrollfun; /* same parameters as ScrollWindowEx */
41 /**************************************************************************
42 * SmoothScrollWindow [COMCTL32.382]
44 * Lots of magic for smooth scrolling windows.
46 * Currently only scrolls ONCE. The comctl32 implementation uses GetTickCount
47 * and what else to do smooth scrolling.
50 BOOL WINAPI SmoothScrollWindow( SMOOTHSCROLLSTRUCT *smooth ) {
51 LPRECT lpupdaterect = smooth->lpupdaterect;
52 HRGN hrgnupdate = smooth->hrgnupdate;
55 DWORD flags = smooth->flags;
57 if (smooth->dwSize!=sizeof(SMOOTHSCROLLSTRUCT))
61 lpupdaterect = &tmprect;
62 SetRectEmpty(lpupdaterect);
64 if (!(flags & 0x40000)) { /* no override, use system wide defaults */
65 if (smoothscroll == 2) {
69 if (!RegOpenKeyA(HKEY_CURRENT_USER,"Control Panel\\Desktop",&hkey)) {
72 RegQueryValueExA(hkey,"SmoothScroll",0,0,(LPBYTE)&smoothscroll,&len);
80 if (flags & 0x20000) { /* are we doing jump scrolling? */
81 if ((smooth->x2 & 1) && smooth->scrollfun)
82 return smooth->scrollfun(
83 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
84 smooth->lpcliprect,hrgnupdate,lpupdaterect,
88 return ScrollWindowEx(
89 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
90 smooth->lpcliprect,hrgnupdate,lpupdaterect,
95 FIXME("(hwnd=%x,flags=%lx,x2=%lx): should smooth scroll here.\n",
96 smooth->hwnd,flags,smooth->x2
98 /* FIXME: do timer based smooth scrolling */
99 if ((smooth->x2 & 1) && smooth->scrollfun)
100 return smooth->scrollfun(
101 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
102 smooth->lpcliprect,hrgnupdate,lpupdaterect,
106 return ScrollWindowEx(
107 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
108 smooth->lpcliprect,hrgnupdate,lpupdaterect,