- Update to r53061
[reactos.git] / dll / cpl / access / keyboard.c
1 /* $Id: keyboard.c 29170 2007-09-23 22:59:00Z ekohl $
2 *
3 * PROJECT: ReactOS Accessibility Control Panel
4 * LICENSE: GPL - See COPYING in the top level directory
5 * FILE: dll/cpl/access/keyboard.c
6 * PURPOSE: Keyboard-related accessibility settings
7 * COPYRIGHT: Copyright 2004 Johannes Anderwald (j_anderw@sbox.tugraz.at)
8 * Copyright 2007 Eric Kohl
9 */
10
11 #include "access.h"
12
13
14 #define BOUNCETICKS 5
15 static UINT nBounceArray[BOUNCETICKS] = {500, 700, 1000, 1500, 2000};
16
17 #define DELAYTICKS 5
18 static UINT nDelayArray[DELAYTICKS] = {300, 700, 1000, 1500, 2000};
19
20 #define REPEATTICKS 6
21 static UINT nRepeatArray[REPEATTICKS] = {300, 500, 700, 1000, 1500, 2000};
22
23 #define WAITTICKS 10
24 static UINT nWaitArray[WAITTICKS] = {0, 300, 500, 700, 1000, 1500, 2000, 5000, 10000, 20000};
25
26
27 static VOID
28 EnableFilterKeysTest(PGLOBAL_DATA pGlobalData)
29 {
30 pGlobalData->filterKeys.dwFlags |= FKF_FILTERKEYSON;
31 pGlobalData->filterKeys.dwFlags &= ~FKF_INDICATOR;
32
33 SystemParametersInfo(SPI_SETFILTERKEYS,
34 sizeof(FILTERKEYS),
35 &pGlobalData->filterKeys,
36 0);
37 }
38
39
40 static VOID
41 DisableFilterKeysTest(PGLOBAL_DATA pGlobalData)
42 {
43 if (pGlobalData->oldFilterKeys.dwFlags & FKF_FILTERKEYSON)
44 {
45 pGlobalData->filterKeys.dwFlags |= FKF_FILTERKEYSON;
46 }
47 else
48 {
49 pGlobalData->filterKeys.dwFlags &= ~FKF_FILTERKEYSON;
50 }
51
52 if (pGlobalData->oldFilterKeys.dwFlags & FKF_INDICATOR)
53 {
54 pGlobalData->filterKeys.dwFlags |= FKF_INDICATOR;
55 }
56 else
57 {
58 pGlobalData->filterKeys.dwFlags &= ~FKF_INDICATOR;
59 }
60
61 SystemParametersInfo(SPI_SETFILTERKEYS,
62 sizeof(FILTERKEYS),
63 &pGlobalData->filterKeys,
64 0);
65 }
66
67
68 /* Property page dialog callback */
69 INT_PTR CALLBACK
70 StickyKeysDlgProc(HWND hwndDlg,
71 UINT uMsg,
72 WPARAM wParam,
73 LPARAM lParam)
74 {
75 PGLOBAL_DATA pGlobalData;
76
77 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
78
79 switch (uMsg)
80 {
81 case WM_INITDIALOG:
82 pGlobalData = (PGLOBAL_DATA)lParam;
83 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
84
85 memcpy(&pGlobalData->oldStickyKeys,
86 &pGlobalData->stickyKeys,
87 sizeof(STICKYKEYS));
88
89 CheckDlgButton(hwndDlg,
90 IDC_STICKY_ACTIVATE_CHECK,
91 pGlobalData->stickyKeys.dwFlags & SKF_HOTKEYACTIVE ? BST_CHECKED : BST_UNCHECKED);
92
93 CheckDlgButton(hwndDlg,
94 IDC_STICKY_LOCK_CHECK,
95 pGlobalData->stickyKeys.dwFlags & SKF_TRISTATE ? BST_CHECKED : BST_UNCHECKED);
96
97 CheckDlgButton(hwndDlg,
98 IDC_STICKY_UNLOCK_CHECK,
99 pGlobalData->stickyKeys.dwFlags & SKF_TWOKEYSOFF ? BST_CHECKED : BST_UNCHECKED);
100
101 CheckDlgButton(hwndDlg,
102 IDC_STICKY_SOUND_CHECK,
103 pGlobalData->stickyKeys.dwFlags & SKF_AUDIBLEFEEDBACK ? BST_CHECKED : BST_UNCHECKED);
104
105 CheckDlgButton(hwndDlg,
106 IDC_STICKY_STATUS_CHECK,
107 pGlobalData->stickyKeys.dwFlags & SKF_INDICATOR ? BST_CHECKED : BST_UNCHECKED);
108 break;
109
110 case WM_COMMAND:
111 switch (LOWORD(wParam))
112 {
113 case IDC_STICKY_ACTIVATE_CHECK:
114 pGlobalData->stickyKeys.dwFlags ^= SKF_HOTKEYACTIVE;
115 break;
116
117 case IDC_STICKY_LOCK_CHECK:
118 pGlobalData->stickyKeys.dwFlags ^= SKF_TRISTATE;
119 break;
120
121 case IDC_STICKY_UNLOCK_CHECK:
122 pGlobalData->stickyKeys.dwFlags ^= SKF_TWOKEYSOFF;
123 break;
124
125 case IDC_STICKY_SOUND_CHECK:
126 pGlobalData->stickyKeys.dwFlags ^= SKF_AUDIBLEFEEDBACK;
127 break;
128
129 case IDC_STICKY_STATUS_CHECK:
130 pGlobalData->stickyKeys.dwFlags ^= SKF_INDICATOR;
131 break;
132
133 case IDOK:
134 EndDialog(hwndDlg,
135 (pGlobalData->stickyKeys.dwFlags != pGlobalData->oldStickyKeys.dwFlags));
136 break;
137
138 case IDCANCEL:
139 EndDialog(hwndDlg, FALSE);
140 break;
141
142 default:
143 break;
144 }
145 break;
146 }
147
148 return FALSE;
149 }
150
151
152 static VOID
153 AddComboBoxTime(HWND hwnd, INT nId, INT nTimeMs)
154 {
155 TCHAR szBuffer[32];
156 TCHAR szSeconds[20];
157
158 if (LoadString(hApplet, IDS_SECONDS, szSeconds, 20) == 0)
159 lstrcpy(szSeconds, L"Seconds");
160
161 _stprintf(szBuffer, _T("%d.%d %s"),
162 nTimeMs / 1000, (nTimeMs % 1000) / 100,
163 szSeconds);
164
165 SendDlgItemMessage(hwnd, nId, CB_ADDSTRING, 0, (LPARAM)szBuffer);
166 }
167
168
169 INT_PTR CALLBACK
170 BounceKeysDlgProc(HWND hwndDlg,
171 UINT uMsg,
172 WPARAM wParam,
173 LPARAM lParam)
174 {
175 PGLOBAL_DATA pGlobalData;
176 INT i, n;
177
178 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
179
180 switch (uMsg)
181 {
182 case WM_INITDIALOG:
183 pGlobalData = (PGLOBAL_DATA)lParam;
184 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
185
186 /* Determine the current bounce time */
187 if (pGlobalData->filterKeys.iBounceMSec == 0)
188 pGlobalData->filterKeys.iBounceMSec = nBounceArray[0];
189
190 for (n = 0; n < BOUNCETICKS; n++)
191 {
192 if (pGlobalData->filterKeys.iBounceMSec < nBounceArray[n])
193 break;
194 }
195 n--;
196
197 for (i = 0; i < BOUNCETICKS; i++)
198 {
199 AddComboBoxTime(hwndDlg, IDC_BOUNCE_TIME_COMBO, nBounceArray[i]);
200 }
201
202 SendDlgItemMessage(hwndDlg, IDC_BOUNCE_TIME_COMBO, CB_SETCURSEL, n, 0);
203 break;
204
205 case WM_COMMAND:
206 switch (LOWORD(wParam))
207 {
208 case IDC_BOUNCE_TIME_COMBO:
209 if (HIWORD(wParam) == CBN_SELCHANGE)
210 {
211 i = SendDlgItemMessage(hwndDlg, IDC_BOUNCE_TIME_COMBO, CB_GETCURSEL, 0, 0);
212 if (i != CB_ERR)
213 {
214 pGlobalData->filterKeys.iBounceMSec = nBounceArray[i];
215 }
216 }
217 break;
218
219 case IDC_BOUNCE_TEST_EDIT:
220 switch (HIWORD(wParam))
221 {
222 case EN_SETFOCUS:
223 EnableFilterKeysTest(pGlobalData);
224 break;
225
226 case EN_KILLFOCUS:
227 DisableFilterKeysTest(pGlobalData);
228 break;
229 }
230 break;
231
232 case IDOK:
233 EndDialog(hwndDlg, TRUE);
234 break;
235
236 case IDCANCEL:
237 EndDialog(hwndDlg, FALSE);
238 break;
239
240 default:
241 break;
242 }
243 break;
244 }
245
246 return FALSE;
247 }
248
249
250 INT_PTR CALLBACK
251 RepeatKeysDlgProc(HWND hwndDlg,
252 UINT uMsg,
253 WPARAM wParam,
254 LPARAM lParam)
255 {
256 PGLOBAL_DATA pGlobalData;
257 INT i, n;
258
259 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
260
261 switch (uMsg)
262 {
263 case WM_INITDIALOG:
264 pGlobalData = (PGLOBAL_DATA)lParam;
265 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
266
267 CheckRadioButton(hwndDlg,
268 IDC_REPEAT_NOREPEAT_RADIO,
269 IDC_REPEAT_REPEAT_RADIO,
270 (pGlobalData->filterKeys.iDelayMSec == 0) ? IDC_REPEAT_NOREPEAT_RADIO : IDC_REPEAT_REPEAT_RADIO);
271
272 /* Initialize the delay combobox */
273 for (n = 0; n < DELAYTICKS; n++)
274 {
275 if (pGlobalData->filterKeys.iDelayMSec < nDelayArray[n])
276 break;
277 }
278 n--;
279
280 for (i = 0; i < DELAYTICKS; i++)
281 {
282 AddComboBoxTime(hwndDlg, IDC_REPEAT_DELAY_COMBO, nDelayArray[i]);
283 }
284
285 SendDlgItemMessage(hwndDlg, IDC_REPEAT_DELAY_COMBO, CB_SETCURSEL, n, 0);
286
287 /* Initialize the repeat combobox */
288 for (n = 0; n < REPEATTICKS; n++)
289 {
290 if (pGlobalData->filterKeys.iRepeatMSec < nRepeatArray[n])
291 break;
292 }
293 n--;
294
295 for (i = 0; i < REPEATTICKS; i++)
296 {
297 AddComboBoxTime(hwndDlg, IDC_REPEAT_REPEAT_COMBO, nRepeatArray[i]);
298 }
299
300 SendDlgItemMessage(hwndDlg, IDC_REPEAT_REPEAT_COMBO, CB_SETCURSEL, n, 0);
301
302 /* Disable the delay and repeat comboboxes if needed */
303 if (pGlobalData->filterKeys.iDelayMSec == 0)
304 {
305 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_DELAY_COMBO), FALSE);
306 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_REPEAT_COMBO), FALSE);
307 }
308
309 /* Initialize the wait combobox */
310 for (n = 0; n < WAITTICKS; n++)
311 {
312 if (pGlobalData->filterKeys.iWaitMSec < nWaitArray[n])
313 break;
314 }
315 n--;
316
317 for (i = 0; i < WAITTICKS; i++)
318 {
319 AddComboBoxTime(hwndDlg, IDC_REPEAT_WAIT_COMBO, nWaitArray[i]);
320 }
321
322 SendDlgItemMessage(hwndDlg, IDC_REPEAT_WAIT_COMBO, CB_SETCURSEL, n, 0);
323 break;
324
325 case WM_COMMAND:
326 switch (LOWORD(wParam))
327 {
328 case IDC_REPEAT_NOREPEAT_RADIO:
329 pGlobalData->filterKeys.iDelayMSec = 0;
330 pGlobalData->filterKeys.iRepeatMSec = 0;
331 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_DELAY_COMBO), FALSE);
332 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_REPEAT_COMBO), FALSE);
333 break;
334
335 case IDC_REPEAT_REPEAT_RADIO:
336 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_DELAY_COMBO), TRUE);
337 EnableWindow(GetDlgItem(hwndDlg, IDC_REPEAT_REPEAT_COMBO), TRUE);
338 break;
339
340 case IDC_REPEAT_DELAY_COMBO:
341 if (HIWORD(wParam) == CBN_SELCHANGE)
342 {
343 i = SendDlgItemMessage(hwndDlg, IDC_REPEAT_DELAY_COMBO, CB_GETCURSEL, 0, 0);
344 if (i != CB_ERR)
345 {
346 pGlobalData->filterKeys.iDelayMSec = nDelayArray[i];
347 }
348 }
349 break;
350
351 case IDC_REPEAT_REPEAT_COMBO:
352 if (HIWORD(wParam) == CBN_SELCHANGE)
353 {
354 i = SendDlgItemMessage(hwndDlg, IDC_REPEAT_REPEAT_COMBO, CB_GETCURSEL, 0, 0);
355 if (i != CB_ERR)
356 {
357 pGlobalData->filterKeys.iRepeatMSec = nRepeatArray[i];
358 }
359 }
360 break;
361
362 case IDC_REPEAT_WAIT_COMBO:
363 if (HIWORD(wParam) == CBN_SELCHANGE)
364 {
365 i = SendDlgItemMessage(hwndDlg, IDC_REPEAT_WAIT_COMBO, CB_GETCURSEL, 0, 0);
366 if (i != CB_ERR)
367 {
368 pGlobalData->filterKeys.iWaitMSec = nWaitArray[i];
369 }
370 }
371 break;
372
373 case IDC_REPEAT_TEST_EDIT:
374 switch (HIWORD(wParam))
375 {
376 case EN_SETFOCUS:
377 EnableFilterKeysTest(pGlobalData);
378 break;
379
380 case EN_KILLFOCUS:
381 DisableFilterKeysTest(pGlobalData);
382 break;
383 }
384 break;
385
386 case IDOK:
387 EndDialog(hwndDlg, TRUE);
388 break;
389
390 case IDCANCEL:
391 EndDialog(hwndDlg, FALSE);
392 break;
393
394 default:
395 break;
396 }
397 break;
398 }
399
400 return FALSE;
401 }
402
403
404 /* Property page dialog callback */
405 INT_PTR CALLBACK
406 FilterKeysDlgProc(HWND hwndDlg,
407 UINT uMsg,
408 WPARAM wParam,
409 LPARAM lParam)
410 {
411 PGLOBAL_DATA pGlobalData;
412
413 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
414
415 switch (uMsg)
416 {
417 case WM_INITDIALOG:
418 pGlobalData = (PGLOBAL_DATA)lParam;
419 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
420
421 memcpy(&pGlobalData->oldFilterKeys,
422 &pGlobalData->filterKeys,
423 sizeof(FILTERKEYS));
424
425 CheckDlgButton(hwndDlg,
426 IDC_FILTER_ACTIVATE_CHECK,
427 pGlobalData->filterKeys.dwFlags & FKF_HOTKEYACTIVE ? BST_CHECKED : BST_UNCHECKED);
428
429 if (pGlobalData->filterKeys.iBounceMSec != 0)
430 {
431 CheckRadioButton(hwndDlg, IDC_FILTER_BOUNCE_RADIO, IDC_FILTER_REPEAT_RADIO, IDC_FILTER_BOUNCE_RADIO);
432 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_BOUNCE_BUTTON), TRUE);
433 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_REPEAT_BUTTON), FALSE);
434 }
435 else
436 {
437 CheckRadioButton(hwndDlg, IDC_FILTER_BOUNCE_RADIO, IDC_FILTER_REPEAT_RADIO, IDC_FILTER_REPEAT_RADIO);
438 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_BOUNCE_BUTTON), FALSE);
439 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_REPEAT_BUTTON), TRUE);
440 }
441
442 CheckDlgButton(hwndDlg,
443 IDC_FILTER_SOUND_CHECK,
444 pGlobalData->filterKeys.dwFlags & FKF_CLICKON ? BST_CHECKED : BST_UNCHECKED);
445
446 CheckDlgButton(hwndDlg,
447 IDC_FILTER_STATUS_CHECK,
448 pGlobalData->filterKeys.dwFlags & FKF_INDICATOR ? BST_CHECKED : BST_UNCHECKED);
449 break;
450
451 case WM_COMMAND:
452 switch (LOWORD(wParam))
453 {
454 case IDC_FILTER_ACTIVATE_CHECK:
455 pGlobalData->filterKeys.dwFlags ^= FKF_HOTKEYACTIVE;
456 break;
457
458 case IDC_FILTER_BOUNCE_RADIO:
459 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_BOUNCE_BUTTON), TRUE);
460 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_REPEAT_BUTTON), FALSE);
461 break;
462
463 case IDC_FILTER_REPEAT_RADIO:
464 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_BOUNCE_BUTTON), FALSE);
465 EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER_REPEAT_BUTTON), TRUE);
466 break;
467
468 case IDC_FILTER_BOUNCE_BUTTON:
469 DialogBoxParam(hApplet,
470 MAKEINTRESOURCE(IDD_BOUNCEKEYSOPTIONS),
471 hwndDlg,
472 (DLGPROC)BounceKeysDlgProc,
473 (LPARAM)pGlobalData);
474 break;
475
476 case IDC_FILTER_TEST_EDIT:
477 switch (HIWORD(wParam))
478 {
479 case EN_SETFOCUS:
480 EnableFilterKeysTest(pGlobalData);
481 break;
482
483 case EN_KILLFOCUS:
484 DisableFilterKeysTest(pGlobalData);
485 break;
486 }
487 break;
488
489 case IDC_FILTER_SOUND_CHECK:
490 pGlobalData->filterKeys.dwFlags ^= FKF_CLICKON;
491 break;
492
493 case IDC_FILTER_REPEAT_BUTTON:
494 DialogBoxParam(hApplet,
495 MAKEINTRESOURCE(IDD_REPEATKEYSOPTIONS),
496 hwndDlg,
497 (DLGPROC)RepeatKeysDlgProc,
498 (LPARAM)pGlobalData);
499 break;
500
501 case IDC_FILTER_STATUS_CHECK:
502 pGlobalData->filterKeys.dwFlags ^= FKF_INDICATOR;
503 break;
504
505 case IDOK:
506 EndDialog(hwndDlg,
507 (pGlobalData->filterKeys.dwFlags != pGlobalData->oldFilterKeys.dwFlags));
508 break;
509
510 case IDCANCEL:
511 EndDialog(hwndDlg, FALSE);
512 break;
513
514 default:
515 break;
516 }
517 break;
518 }
519
520 return FALSE;
521 }
522
523
524 /* Property page dialog callback */
525 INT_PTR CALLBACK
526 ToggleKeysDlgProc(HWND hwndDlg,
527 UINT uMsg,
528 WPARAM wParam,
529 LPARAM lParam)
530 {
531 PGLOBAL_DATA pGlobalData;
532
533 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
534
535 switch (uMsg)
536 {
537 case WM_INITDIALOG:
538 pGlobalData = (PGLOBAL_DATA)lParam;
539 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
540
541 memcpy(&pGlobalData->oldToggleKeys,
542 &pGlobalData->toggleKeys,
543 sizeof(TOGGLEKEYS));
544
545 CheckDlgButton(hwndDlg,
546 IDC_TOGGLE_ACTIVATE_CHECK,
547 pGlobalData->toggleKeys.dwFlags & TKF_HOTKEYACTIVE ? BST_CHECKED : BST_UNCHECKED);
548 break;
549
550 case WM_COMMAND:
551 switch (LOWORD(wParam))
552 {
553 case IDC_TOGGLE_ACTIVATE_CHECK:
554 pGlobalData->toggleKeys.dwFlags ^= TKF_HOTKEYACTIVE;
555 break;
556
557 case IDOK:
558 EndDialog(hwndDlg,
559 (pGlobalData->toggleKeys.dwFlags != pGlobalData->oldToggleKeys.dwFlags));
560 break;
561
562 case IDCANCEL:
563 EndDialog(hwndDlg, FALSE);
564 break;
565
566 default:
567 break;
568 }
569 break;
570 }
571
572 return FALSE;
573 }
574
575
576 /* Property page dialog callback */
577 INT_PTR CALLBACK
578 KeyboardPageProc(HWND hwndDlg,
579 UINT uMsg,
580 WPARAM wParam,
581 LPARAM lParam)
582 {
583 PGLOBAL_DATA pGlobalData;
584 LPPSHNOTIFY lppsn;
585
586 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
587
588 switch (uMsg)
589 {
590 case WM_INITDIALOG:
591 pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
592 if (pGlobalData == NULL)
593 return FALSE;
594
595 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
596
597 CheckDlgButton(hwndDlg,
598 IDC_STICKY_BOX,
599 pGlobalData->stickyKeys.dwFlags & SKF_STICKYKEYSON ? BST_CHECKED : BST_UNCHECKED);
600
601 CheckDlgButton(hwndDlg,
602 IDC_FILTER_BOX,
603 pGlobalData->filterKeys.dwFlags & FKF_FILTERKEYSON ? BST_CHECKED : BST_UNCHECKED);
604
605 CheckDlgButton(hwndDlg,
606 IDC_TOGGLE_BOX,
607 pGlobalData->toggleKeys.dwFlags & TKF_TOGGLEKEYSON ? BST_CHECKED : BST_UNCHECKED);
608
609 CheckDlgButton(hwndDlg,
610 IDC_KEYBOARD_EXTRA,
611 pGlobalData->bKeyboardPref ? BST_CHECKED : BST_UNCHECKED);
612 return TRUE;
613
614 case WM_COMMAND:
615 switch (LOWORD(wParam))
616 {
617 case IDC_STICKY_BOX:
618 pGlobalData->stickyKeys.dwFlags ^= SKF_STICKYKEYSON;
619 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
620 break;
621
622 case IDC_STICKY_BUTTON:
623 if (DialogBoxParam(hApplet,
624 MAKEINTRESOURCE(IDD_STICKYKEYSOPTIONS),
625 hwndDlg,
626 (DLGPROC)StickyKeysDlgProc,
627 (LPARAM)pGlobalData))
628 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
629 break;
630
631 case IDC_FILTER_BOX:
632 pGlobalData->filterKeys.dwFlags ^= FKF_FILTERKEYSON;
633 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
634 break;
635
636 case IDC_FILTER_BUTTON:
637 if (DialogBoxParam(hApplet,
638 MAKEINTRESOURCE(IDD_FILTERKEYSOPTIONS),
639 hwndDlg,
640 (DLGPROC)FilterKeysDlgProc,
641 (LPARAM)pGlobalData))
642 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
643 break;
644
645 case IDC_TOGGLE_BOX:
646 pGlobalData->toggleKeys.dwFlags ^= TKF_TOGGLEKEYSON;
647 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
648 break;
649
650 case IDC_TOGGLE_BUTTON:
651 if (DialogBoxParam(hApplet,
652 MAKEINTRESOURCE(IDD_TOGGLEKEYSOPTIONS),
653 hwndDlg,
654 (DLGPROC)ToggleKeysDlgProc,
655 (LPARAM)pGlobalData))
656 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
657 break;
658
659 case IDC_KEYBOARD_EXTRA:
660 pGlobalData->bKeyboardPref = !pGlobalData->bKeyboardPref;
661 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
662 break;
663
664 default:
665 break;
666 }
667 break;
668
669 case WM_NOTIFY:
670 lppsn = (LPPSHNOTIFY)lParam;
671 if (lppsn->hdr.code == PSN_APPLY)
672 {
673 SystemParametersInfo(SPI_SETSTICKYKEYS,
674 sizeof(STICKYKEYS),
675 &pGlobalData->stickyKeys,
676 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/);
677
678 SystemParametersInfo(SPI_SETFILTERKEYS,
679 sizeof(FILTERKEYS),
680 &pGlobalData->filterKeys,
681 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/);
682
683 SystemParametersInfo(SPI_SETTOGGLEKEYS,
684 sizeof(TOGGLEKEYS),
685 &pGlobalData->toggleKeys,
686 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/);
687
688 SystemParametersInfo(SPI_SETKEYBOARDPREF,
689 pGlobalData->bKeyboardPref,
690 NULL,
691 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/);
692
693 return TRUE;
694 }
695 break;
696 }
697
698 return FALSE;
699 }