Move __stdcall/__cdecl to the right place.
[wine/multimedia.git] / dlls / comctl32 / smoothscroll.c
blobe3bf9b65dc2689879cfa6203512ecffa1938a2d4
1 /*
2 * Undocumented SmoothScrollWindow function from COMCTL32.DLL
4 * Copyright 2000 Marcus Meissner <marcus@jet.franken.de>
6 * TODO
7 * - actually add smooth scrolling
8 */
10 #include "winbase.h"
11 #include "winreg.h"
12 #include "winerror.h"
13 #include "commctrl.h"
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 {
22 DWORD dwSize;
23 DWORD x2;
24 HWND hwnd;
25 DWORD dx;
27 DWORD dy;
28 LPRECT lpscrollrect;
29 LPRECT lpcliprect;
30 HRGN hrgnupdate;
32 LPRECT lpupdaterect;
33 DWORD flags;
34 DWORD stepinterval;
35 DWORD dx_step;
37 DWORD dy_step;
38 SCROLLWINDOWEXPROC scrollfun; /* same parameters as ScrollWindowEx */
39 } SMOOTHSCROLLSTRUCT;
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;
53 RECT tmprect;
54 BOOL ret = TRUE;
55 DWORD flags = smooth->flags;
57 if (smooth->dwSize!=sizeof(SMOOTHSCROLLSTRUCT))
58 return FALSE;
60 if (!lpupdaterect)
61 lpupdaterect = &tmprect;
62 SetRectEmpty(lpupdaterect);
64 if (!(flags & 0x40000)) { /* no override, use system wide defaults */
65 if (smoothscroll == 2) {
66 HKEY hkey;
68 smoothscroll = 0;
69 if (!RegOpenKeyA(HKEY_CURRENT_USER,"Control Panel\\Desktop",&hkey)) {
70 DWORD len = 4;
72 RegQueryValueExA(hkey,"SmoothScroll",0,0,(LPBYTE)&smoothscroll,&len);
73 RegCloseKey(hkey);
76 if (!smoothscroll)
77 flags |= 0x20000;
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,
85 flags & 0xffff
87 else
88 return ScrollWindowEx(
89 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
90 smooth->lpcliprect,hrgnupdate,lpupdaterect,
91 flags & 0xffff
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,
103 flags & 0xffff
105 else
106 return ScrollWindowEx(
107 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
108 smooth->lpcliprect,hrgnupdate,lpupdaterect,
109 flags & 0xffff
111 return ret;