ReactOS 0.4.15-dev-7842-g558ab78
display.c File Reference
#include "access.h"
#include <wingdi.h>
Include dependency graph for display.c:

Go to the source code of this file.

Macros

#define ID_BLINK_TIMER   346
 

Functions

static VOID UpdateCaretBlinkTimeReg (_In_ UINT uCaretBlinkTime)
 
static VOID FillColorSchemeComboBox (HWND hwnd)
 
INT_PTR CALLBACK HighContrastDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK DisplayPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ ID_BLINK_TIMER

#define ID_BLINK_TIMER   346

Definition at line 14 of file display.c.

Function Documentation

◆ DisplayPageProc()

INT_PTR CALLBACK DisplayPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 152 of file display.c.

156{
157 PGLOBAL_DATA pGlobalData;
158 LPPSHNOTIFY lppsn;
159 INT i;
160
161 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
162
163 switch (uMsg)
164 {
165 case WM_INITDIALOG:
166 pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
167 if (pGlobalData == NULL)
168 return FALSE;
169
170 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
171
172 pGlobalData->fShowCaret = TRUE;
173 GetWindowRect(GetDlgItem(hwndDlg, IDC_CURSOR_WIDTH_TEXT), &pGlobalData->rcCaret);
174 ScreenToClient(hwndDlg, (LPPOINT)&pGlobalData->rcCaret.left);
175 ScreenToClient(hwndDlg, (LPPOINT)&pGlobalData->rcCaret.right);
176 CopyRect(&pGlobalData->rcOldCaret, &pGlobalData->rcCaret);
177
178 pGlobalData->rcCaret.right = pGlobalData->rcCaret.left + pGlobalData->uCaretWidth;
179
180 /* Set the checkbox */
181 CheckDlgButton(hwndDlg,
184
186 SendDlgItemMessage(hwndDlg, IDC_CURSOR_BLINK_TRACK, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(12 - (pGlobalData->uCaretBlinkTime / 100)));
187
190
191 /* Start the blink timer */
192 pGlobalData->uCaretBlinkTime = pGlobalData->uCaretBlinkTime >= 1200 ? -1 : pGlobalData->uCaretBlinkTime;
193 if ((INT)pGlobalData->uCaretBlinkTime > 0)
194 {
195 SetTimer(hwndDlg, ID_BLINK_TIMER, pGlobalData->uCaretBlinkTime, NULL);
196 }
197 else
198 {
199 PostMessage(hwndDlg, WM_TIMER, ID_BLINK_TIMER, 0);
200 }
201
202 return TRUE;
203
204 case WM_COMMAND:
205 switch (LOWORD(wParam))
206 {
207 case IDC_CONTRAST_BOX:
209 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
210 break;
211
215 hwndDlg,
217 (LPARAM)pGlobalData))
218 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
219 break;
220
221 default:
222 break;
223 }
224 break;
225
226 case WM_HSCROLL:
228 {
231 pGlobalData->uCaretBlinkTime = (12 - (UINT)i) * 100;
232 KillTimer(hwndDlg, ID_BLINK_TIMER);
233 pGlobalData->uCaretBlinkTime = pGlobalData->uCaretBlinkTime >= 1200 ? -1 : pGlobalData->uCaretBlinkTime;
234 if ((INT)pGlobalData->uCaretBlinkTime > 0)
235 {
236 SetTimer(hwndDlg, ID_BLINK_TIMER, pGlobalData->uCaretBlinkTime, NULL);
237 }
238 else if (pGlobalData->fShowCaret)
239 {
240 SendMessage(hwndDlg, WM_TIMER, ID_BLINK_TIMER, 0);
241 }
242 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
243 break;
244
247 pGlobalData->uCaretWidth = (UINT)i + 1;
248 pGlobalData->rcCaret.right = pGlobalData->rcCaret.left + pGlobalData->uCaretWidth;
249 if (pGlobalData->fShowCaret)
250 {
251 HDC hDC = GetDC(hwndDlg);
252 HBRUSH hBrush = GetSysColorBrush(COLOR_BTNTEXT);
253 FillRect(hDC, &pGlobalData->rcCaret, hBrush);
254 ReleaseDC(hwndDlg, hDC);
255 }
256 else
257 {
258 InvalidateRect(hwndDlg, &pGlobalData->rcOldCaret, TRUE);
259 }
260 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
261 break;
262 }
263 break;
264
265 case WM_TIMER:
266 if (wParam == ID_BLINK_TIMER)
267 {
268 if (pGlobalData->fShowCaret)
269 {
270 HDC hDC = GetDC(hwndDlg);
271 HBRUSH hBrush = GetSysColorBrush(COLOR_BTNTEXT);
272 FillRect(hDC, &pGlobalData->rcCaret, hBrush);
273 ReleaseDC(hwndDlg, hDC);
274 }
275 else
276 {
277 InvalidateRect(hwndDlg, &pGlobalData->rcOldCaret, TRUE);
278 }
279
280 pGlobalData->fShowCaret = !pGlobalData->fShowCaret;
281 }
282 break;
283
284 case WM_NOTIFY:
285 lppsn = (LPPSHNOTIFY)lParam;
286 if (lppsn->hdr.code == PSN_APPLY)
287 {
288 if (SetCaretBlinkTime(pGlobalData->uCaretBlinkTime))
289 {
290 UpdateCaretBlinkTimeReg(pGlobalData->uCaretBlinkTime);
291 }
292
293 SystemParametersInfo(SPI_SETCARETWIDTH,
294 0,
295 IntToPtr(pGlobalData->uCaretWidth),
297 SystemParametersInfo(SPI_SETHIGHCONTRAST,
298 sizeof(HIGHCONTRAST),
299 &pGlobalData->highContrast,
301 return TRUE;
302 }
303 break;
304
305 case WM_DESTROY:
306 KillTimer(hwndDlg, ID_BLINK_TIMER);
307 break;
308 }
309
310 return FALSE;
311}
static HDC hDC
Definition: 3dtext.c:33
struct _GLOBAL_DATA * PGLOBAL_DATA
#define IntToPtr(i)
Definition: basetsd.h:89
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define ID_BLINK_TIMER
Definition: display.c:14
INT_PTR CALLBACK HighContrastDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: display.c:84
static VOID UpdateCaretBlinkTimeReg(_In_ UINT uCaretBlinkTime)
Definition: display.c:17
#define IDD_CONTRASTOPTIONS
Definition: resource.h:18
#define IDC_CURSOR_WIDTH_TRACK
Definition: resource.h:90
#define IDC_CURSOR_BLINK_TRACK
Definition: resource.h:89
#define IDC_CONTRAST_BOX
Definition: resource.h:47
#define IDC_CONTRAST_BUTTON
Definition: resource.h:48
#define IDC_CURSOR_WIDTH_TEXT
Definition: resource.h:91
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HDC
Definition: imagelist.c:92
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
#define TBM_GETPOS
Definition: commctrl.h:2031
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
#define WM_NOTIFY
Definition: richedit.h:61
BOOL fShowCaret
Definition: access.h:45
UINT uCaretWidth
Definition: access.h:44
UINT uCaretBlinkTime
Definition: access.h:43
RECT rcCaret
Definition: access.h:46
HIGHCONTRAST highContrast
Definition: access.h:42
RECT rcOldCaret
Definition: access.h:47
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3159
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define HCF_HIGHCONTRASTON
Definition: winuser.h:2134
#define COLOR_BTNTEXT
Definition: winuser.h:933
#define DWLP_USER
Definition: winuser.h:872
#define WM_HSCROLL
Definition: winuser.h:1743
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define GWL_ID
Definition: winuser.h:859
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_COMMAND
Definition: winuser.h:1740
BOOL WINAPI SetCaretBlinkTime(_In_ UINT)
#define DialogBoxParam
Definition: winuser.h:5764
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define SPIF_SENDCHANGE
Definition: winuser.h:1572
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1571
#define WM_TIMER
Definition: winuser.h:1742
#define SendMessage
Definition: winuser.h:5843
HDC WINAPI GetDC(_In_opt_ HWND)
#define PostMessage
Definition: winuser.h:5832
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SystemParametersInfo
Definition: winuser.h:5858
#define SendDlgItemMessage
Definition: winuser.h:5842
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by SystemApplet().

◆ FillColorSchemeComboBox()

static VOID FillColorSchemeComboBox ( HWND  hwnd)
static

Definition at line 42 of file display.c.

43{
44 TCHAR szValue[128];
45 DWORD dwDisposition;
47 HKEY hKey;
48 LONG lError;
49 INT i;
50
52 _T("Control Panel\\Appearance\\Schemes"),
53 0,
54 NULL,
57 NULL,
58 &hKey,
59 &dwDisposition);
60 if (lError != ERROR_SUCCESS)
61 return;
62
63 for (i = 0; ; i++)
64 {
65 dwLength = 128;
66 lError = RegEnumValue(hKey,
67 i,
68 szValue,
70 if (lError == ERROR_NO_MORE_ITEMS)
71 break;
72
75 0,
76 (LPARAM)szValue);
77 }
78
80}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
static DWORD DWORD * dwLength
Definition: fusion.c:86
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_EXECUTE
Definition: nt_native.h:1037
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
long LONG
Definition: pedump.c:60
#define _T(x)
Definition: vfdio.h:22
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegCreateKeyEx
Definition: winreg.h:501
#define RegEnumValue
Definition: winreg.h:511
#define CB_ADDSTRING
Definition: winuser.h:1936
char TCHAR
Definition: xmlstorage.h:189

Referenced by HighContrastDlgProc().

◆ HighContrastDlgProc()

INT_PTR CALLBACK HighContrastDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 84 of file display.c.

88{
89 PGLOBAL_DATA pGlobalData;
90
91 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
92
93 switch (uMsg)
94 {
95 case WM_INITDIALOG:
96 pGlobalData = (PGLOBAL_DATA)lParam;
97 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
98
99 CheckDlgButton(hwndDlg,
102
104
105 SendDlgItemMessage(hwndDlg,
108 (WPARAM)-1,
110 break;
111
112 case WM_COMMAND:
113 switch (LOWORD(wParam))
114 {
116 pGlobalData->highContrast.dwFlags ^= HCF_HOTKEYACTIVE;
117 break;
118
121 {
122 INT nSel;
123
125 CB_GETCURSEL, 0, 0);
127 CB_GETLBTEXT, nSel,
129 }
130 break;
131
132 case IDOK:
133 EndDialog(hwndDlg, TRUE);
134 break;
135
136 case IDCANCEL:
137 EndDialog(hwndDlg, FALSE);
138 break;
139
140 default:
141 break;
142 }
143 break;
144 }
145
146 return FALSE;
147}
static VOID FillColorSchemeComboBox(HWND hwnd)
Definition: display.c:42
#define IDC_CONTRAST_COMBO
Definition: resource.h:88
#define IDC_CONTRAST_ACTIVATE_CHECK
Definition: resource.h:87
LPSTR lpszDefaultScheme
Definition: winuser.h:3366
#define HIWORD(l)
Definition: typedefs.h:247
#define CB_SELECTSTRING
Definition: winuser.h:1960
#define CB_GETLBTEXT
Definition: winuser.h:1952
#define IDCANCEL
Definition: winuser.h:831
#define IDOK
Definition: winuser.h:830
#define CBN_SELCHANGE
Definition: winuser.h:1979
#define HCF_HOTKEYACTIVE
Definition: winuser.h:2136
#define CB_GETCURSEL
Definition: winuser.h:1943
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by DisplayPageProc().

◆ UpdateCaretBlinkTimeReg()

static VOID UpdateCaretBlinkTimeReg ( _In_ UINT  uCaretBlinkTime)
static

Definition at line 17 of file display.c.

19{
20 HKEY hKey;
21 WCHAR szBuffer[12];
22
24 L"Control Panel\\Desktop",
27 {
28 return;
29 }
30
31 wsprintf(szBuffer, L"%d", uCaretBlinkTime);
32
33 RegSetValueExW(hKey, L"CursorBlinkRate",
34 0, REG_SZ,
35 (CONST BYTE*)szBuffer,
36 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
37
39}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define L(x)
Definition: ntvdm.h:50
#define CONST
Definition: pedump.c:81
#define wsprintf
Definition: winuser.h:5865
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DisplayPageProc().