Author: mkupfer
Date: Tue Oct 6 11:02:31 2009
New Revision: 43312
URL:
http://svn.reactos.org/svn/reactos?rev=43312&view=rev
Log:
- bind (almost all) mouse settings to system and registry and fixup sysparams
Modified:
trunk/reactos/dll/cpl/main/mouse.c
trunk/reactos/subsystems/win32/win32k/include/sysparams.h
trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
Modified: trunk/reactos/dll/cpl/main/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/mouse.c?rev=4…
==============================================================================
--- trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] Tue Oct 6 11:02:31 2009
@@ -333,6 +333,7 @@
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED,
(LPARAM)0);
SendDlgItemMessage(hwndDlg, IDC_IMAGE_SWAP_MOUSE, STM_SETIMAGE,
IMAGE_ICON, (LPARAM)pButtonData->hButtonRight);
}
+ //SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP,
pButtonData->g_SwapMouseButtons, NULL, 0);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
@@ -379,6 +380,8 @@
SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP,
pButtonData->g_OrigSwapMouseButtons, NULL, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
}
+ SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_DoubleClickSpeed, NULL, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
+ //SetDoubleClickTime(pButtonData->g_DoubleClickSpeed);
#if (WINVER >= 0x0500)
SystemParametersInfo(SPI_SETMOUSECLICKLOCK,
pButtonData->g_ClickLockEnabled, NULL, SPIF_SENDCHANGE);
@@ -392,8 +395,8 @@
SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP,
pButtonData->g_OrigSwapMouseButtons, NULL, 0);
/* Reset double click speed setting */
-// SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_OrigDoubleClickSpeed, NULL, 0);
- SetDoubleClickTime(pButtonData->g_OrigDoubleClickSpeed);
+ SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_OrigDoubleClickSpeed, NULL, 0);
+ //SetDoubleClickTime(pButtonData->g_OrigDoubleClickSpeed);
}
return TRUE;
@@ -411,14 +414,14 @@
case TB_ENDTRACK:
lResult = SendDlgItemMessage(hwndDlg,
IDC_SLIDER_DOUBLE_CLICK_SPEED, TBM_GETPOS, 0, 0);
pButtonData->g_DoubleClickSpeed = (14 - (INT)lResult) * 50 +
200;
-// SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_DoubleClickSpeed, NULL, 0);
+ //SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_DoubleClickSpeed, NULL, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
SetDoubleClickTime(pButtonData->g_DoubleClickSpeed);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
case TB_THUMBTRACK:
pButtonData->g_DoubleClickSpeed = (14 - (INT)HIWORD(wParam)) *
50 + 200;
-// SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_DoubleClickSpeed, NULL, 0);
+ //SystemParametersInfo(SPI_SETDOUBLECLICKTIME,
pButtonData->g_DoubleClickSpeed, NULL, 0);
SetDoubleClickTime(pButtonData->g_DoubleClickSpeed);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
@@ -1412,23 +1415,19 @@
pOptionData->OrigMouseAccel.nThreshold2 =
pOptionData->MouseAccel.nThreshold2;
/* snap to default button */
- if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0,
&pOptionData->bSnapToDefaultButton, 0))
- pOptionData->bSnapToDefaultButton = FALSE;
+ SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0,
&pOptionData->bSnapToDefaultButton, 0);
pOptionData->bOrigSnapToDefaultButton =
pOptionData->bSnapToDefaultButton;
/* mouse trails */
- if (!SystemParametersInfo(SPI_GETMOUSETRAILS, 0,
&pOptionData->uMouseTrails, 0))
- pOptionData->uMouseTrails = 0;
+ SystemParametersInfo(SPI_GETMOUSETRAILS, 0,
&pOptionData->uMouseTrails, 0);
pOptionData->uOrigMouseTrails = pOptionData->uMouseTrails;
/* hide pointer while typing */
- if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0,
&pOptionData->bMouseVanish, 0))
- pOptionData->bMouseVanish = FALSE;
+ SystemParametersInfo(SPI_GETMOUSEVANISH, 0,
&pOptionData->bMouseVanish, 0);
pOptionData->bOrigMouseVanish = pOptionData->bMouseVanish;
/* show pointer with Ctrl-Key */
- if (!SystemParametersInfo(SPI_GETMOUSESONAR, 0,
&pOptionData->bMouseSonar, 0))
- pOptionData->bMouseSonar = FALSE;
+ SystemParametersInfo(SPI_GETMOUSESONAR, 0, &pOptionData->bMouseSonar,
0);
pOptionData->bOrigMouseSonar = pOptionData->bMouseSonar;
/* Set mouse speed */
@@ -1744,10 +1743,7 @@
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pWheelData);
/* Get wheel scroll lines */
- if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
&pWheelData->uWheelScrollLines, 0))
- {
- pWheelData->uWheelScrollLines = DEFAULT_WHEEL_SCROLL_LINES;
- }
+ SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
&pWheelData->uWheelScrollLines, 0);
ShowDialogWheelControls(hwndDlg, pWheelData->uWheelScrollLines, TRUE);
SendDlgItemMessage(hwndDlg, IDC_UPDOWN_WHEEL_SCROLL_LINES, UDM_SETRANGE, 0,
MAKELONG((short)100, (short)0));
Modified: trunk/reactos/subsystems/win32/win32k/include/sysparams.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/sysparams.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/sysparams.h [iso-8859-1] Tue Oct 6
11:02:31 2009
@@ -31,6 +31,7 @@
UPM_TOOLTIPANIMATION = 0x800,
UPM_TOOLTIPFADE = 0x1000,
UPM_CURSORSHADOW = 0x2000,
+ UPM_CLICKLOCK = 0x8000,
// room for more
UPM_UIEFFECTS = 0x80000000,
UPM_DEFAULT = 0x80003E9E
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Tue Oct 6
11:02:31 2009
@@ -66,6 +66,7 @@
static const WCHAR* VAL_DRAGWIDTH = L"DragWidth";
static const WCHAR* VAL_FNTSMOOTH = L"FontSmoothing";
static const WCHAR* VAL_SCRLLLINES = L"WheelScrollLines";
+static const WCHAR* VAL_CLICKLOCKTIME = L"ClickLockTime";
#if (_WIN32_WINNT >= 0x0600)
static const WCHAR* VAL_SCRLLCHARS = L"WheelScrollChars";
#endif
@@ -94,6 +95,18 @@
/** Loading the settings ******************************************************/
+
+static
+INT
+SpiLoadDWord(PCWSTR pwszKey, PCWSTR pwszValue, INT iValue)
+{
+ DWORD Result;
+ if (!RegReadUserSetting(pwszKey, pwszValue, REG_DWORD, &Result, sizeof(Result)))
+ {
+ return iValue;
+ }
+ return Result;
+}
static
INT
@@ -235,6 +248,7 @@
/* Load desktop settings */
gspv.bDragFullWindows = SpiLoadInt(KEY_DESKTOP, VAL_DRAG, 0);
gspv.iWheelScrollLines = SpiLoadInt(KEY_DESKTOP, VAL_SCRLLLINES, 3);
+ gspv.dwMouseClickLockTime = SpiLoadDWord(KEY_DESKTOP, VAL_CLICKLOCKTIME, 1200);
#if (_WIN32_WINNT >= 0x0600)
gspv.iWheelScrollChars = SpiLoadInt(KEY_DESKTOP, VAL_SCRLLCHARS, 3);
#endif
@@ -299,6 +313,17 @@
static
VOID
+SpiStoreDWord(PCWSTR pwszKey, PCWSTR pwszValue, DWORD Value)
+{
+ RegWriteUserSetting(pwszKey,
+ pwszValue,
+ REG_DWORD,
+ &Value,
+ sizeof(Value));
+}
+
+static
+VOID
SpiStoreSz(PCWSTR pwszKey, PCWSTR pwszValue, PCWSTR pwsz)
{
RegWriteUserSetting(pwszKey,
@@ -442,6 +467,19 @@
if (fl & SPIF_UPDATEINIFILE)
{
SpiStoreSzInt(pwszKey, pwszValue, iValue);
+ }
+ return (UINT_PTR)pwszKey;
+}
+
+static inline
+UINT_PTR
+SpiSetDWord(PVOID pvData, INT iValue, PCWSTR pwszKey, PCWSTR pwszValue, FLONG fl)
+{
+ REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ *(INT*)pvData = iValue;
+ if (fl & SPIF_UPDATEINIFILE)
+ {
+ SpiStoreDWord(pwszKey, pwszValue, iValue);
}
return (UINT_PTR)pwszKey;
}
@@ -1268,10 +1306,10 @@
return SpiSetBool(&gspv.bMouseSonar, uiParam, KEY_MOUSE, L"",
fl);
case SPI_GETMOUSECLICKLOCK:
- return SpiGetInt(pvParam, &gspv.bMouseClickLock, fl);
+ return SpiGetUserPref(UPM_CLICKLOCK, pvParam, fl);
case SPI_SETMOUSECLICKLOCK:
- return SpiSetBool(&gspv.bMouseClickLock, uiParam, KEY_MOUSE,
L"", fl);
+ return SpiSetUserPref(UPM_CLICKLOCK, pvParam, fl);
case SPI_GETMOUSEVANISH:
return SpiGetInt(pvParam, &gspv.bMouseVanish, fl);
@@ -1351,7 +1389,7 @@
return SpiGetInt(pvParam, &gspv.dwMouseClickLockTime, fl);
case SPI_SETMOUSECLICKLOCKTIME:
- return SpiSetInt(&gspv.dwMouseClickLockTime, uiParam, KEY_MOUSE,
L"", fl);
+ return SpiSetDWord(&gspv.dwMouseClickLockTime, uiParam, KEY_DESKTOP,
VAL_CLICKLOCKTIME, fl);
case SPI_GETFONTSMOOTHINGTYPE:
return SpiGetInt(pvParam, &gspv.uiFontSmoothingType, fl);