ReactOS 0.4.15-dev-7842-g558ab78
smoothscroll.c
Go to the documentation of this file.
1/*
2 * Undocumented SmoothScrollWindow function from COMCTL32.DLL
3 *
4 * Copyright 2000 Marcus Meissner <marcus@jet.franken.de>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * TODO
21 * - actually add smooth scrolling
22 */
23
24#include <stdarg.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "winreg.h"
29#include "winerror.h"
30#include "winuser.h"
31#include "wine/debug.h"
32
34
36
38typedef struct tagSMOOTHSCROLLSTRUCT {
43
48
53
55 SCROLLWINDOWEXPROC scrollfun; /* same parameters as ScrollWindowEx */
57
58/**************************************************************************
59 * SmoothScrollWindow [COMCTL32.382]
60 *
61 * Lots of magic for smooth scrolling windows.
62 *
63 * RETURNS
64 * Success: TRUE
65 * Failure: FALSE
66 *
67 * BUGS
68 * Currently only scrolls ONCE. The comctl32 implementation uses GetTickCount
69 * and what else to do smooth scrolling.
70 */
72 LPRECT lpupdaterect = smooth->lpupdaterect;
73 HRGN hrgnupdate = smooth->hrgnupdate;
74 RECT tmprect;
75 DWORD flags = smooth->flags;
76
77 if (smooth->dwSize!=sizeof(SMOOTHSCROLLSTRUCT))
78 return FALSE;
79
80 if (!lpupdaterect)
81 lpupdaterect = &tmprect;
82 SetRectEmpty(lpupdaterect);
83
84 if (!(flags & 0x40000)) { /* no override, use system wide defaults */
85 if (smoothscroll == 2) {
86 HKEY hkey;
87
88 smoothscroll = 0;
89 if (!RegOpenKeyA(HKEY_CURRENT_USER,"Control Panel\\Desktop",&hkey)) {
90 DWORD len = 4;
91
92 RegQueryValueExA(hkey,"SmoothScroll",0,0,(LPBYTE)&smoothscroll,&len);
93 RegCloseKey(hkey);
94 }
95 }
96 if (!smoothscroll)
97 flags |= 0x20000;
98 }
99
100 if (flags & 0x20000) { /* are we doing jump scrolling? */
101 if ((smooth->x2 & 1) && smooth->scrollfun)
102 return smooth->scrollfun(
103 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
104 smooth->lpcliprect,hrgnupdate,lpupdaterect,
105 flags & 0xffff
106 );
107 else
108 return ScrollWindowEx(
109 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
110 smooth->lpcliprect,hrgnupdate,lpupdaterect,
111 flags & 0xffff
112 );
113 }
114
115 FIXME("(hwnd=%p,flags=%x,x2=%x): should smooth scroll here.\n",
116 smooth->hwnd,flags,smooth->x2
117 );
118 /* FIXME: do timer based smooth scrolling */
119 if ((smooth->x2 & 1) && smooth->scrollfun)
120 return smooth->scrollfun(
121 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
122 smooth->lpcliprect,hrgnupdate,lpupdaterect,
123 flags & 0xffff
124 );
125 else
126 return ScrollWindowEx(
127 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect,
128 smooth->lpcliprect,hrgnupdate,lpupdaterect,
129 flags & 0xffff
130 );
131}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: debug.h:111
#define RegCloseKey(hKey)
Definition: registry.h:49
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define INT
Definition: polytest.cpp:20
struct tagSMOOTHSCROLLSTRUCT SMOOTHSCROLLSTRUCT
BOOL WINAPI SmoothScrollWindow(const SMOOTHSCROLLSTRUCT *smooth)
Definition: smoothscroll.c:71
BOOL(CALLBACK * SCROLLWINDOWEXPROC)(HWND, INT, INT, LPRECT, LPRECT, HRGN, LPRECT, DWORD)
Definition: smoothscroll.c:37
static DWORD smoothscroll
Definition: smoothscroll.c:35
SCROLLWINDOWEXPROC scrollfun
Definition: smoothscroll.c:55
unsigned char * LPBYTE
Definition: typedefs.h:53
#define LPRECT
Definition: precomp.h:28
#define WINAPI
Definition: msvc.h:6
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)