Author: greatlrd
Date: Mon Jul 10 04:26:56 2006
New Revision: 22985
URL:
http://svn.reactos.org/svn/reactos?rev=22985&view=rev
Log:
Changes for Screen saver And implement
1. Time value can be changes use SPI_SETSCREENSAVETIMEOUT to set the new value, current
insate value are set to 30sec
2. SPI_GETSCREENSAVETIMEOUT Get the screen saver timeout value.
3. Dectect if screen saver is running with SPI_GETSCREENSAVERRUNNING
4. Set the state of screen saver with SPI_SETSCREENSAVERRUNNING <- this is internal
api see msdn
Implement for mouse
1. SPI_GETWHEELSCROLLLINES I am but unsure if win32k need more changes it seam like it is
only a counter that should be set/get a value and user apps take care of the rest.
Implement it for jimtabor did request it.
2. SPI_GETWHEELSCROLLCHARS I am but unsure if win32k need more changes it seam like it is
only a counter that should be set/get a value and user apps take care of the rest.
Modified:
trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
trunk/reactos/subsystems/win32/win32k/include/winsta.h
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/cursoricon.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/cursoricon.h Mon Jul 10 04:26:56 2006
@@ -38,6 +38,8 @@
UINT ButtonsDown;
CURSORCLIP_INFO CursorClipInfo;
PCURICON_OBJECT CurrentCursorObject;
+ UINT WheelScroLines;
+ UINT WheelScroChars;
BYTE ShowingCursor;
UINT DblClickSpeed;
UINT DblClickWidth;
@@ -46,6 +48,7 @@
LONG LastBtnDownX;
LONG LastBtnDownY;
HANDLE LastClkWnd;
+ BOOL ScreenSaverRunning;
} SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO;
HCURSOR FASTCALL IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
BOOL ForceChange);
Modified: trunk/reactos/subsystems/win32/win32k/include/winsta.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/winsta.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/winsta.h Mon Jul 10 04:26:56 2006
@@ -32,6 +32,10 @@
UINT CaretBlinkRate;
HANDLE ShellWindow;
HANDLE ShellListView;
+
+ /* ScreenSaver */
+ BOOL ScreenSaverRunning;
+ UINT ScreenSaverTimeOut;
/* Wallpaper */
HANDLE hbmWallpaper;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c Mon Jul 10 04:26:56 2006
@@ -55,6 +55,8 @@
PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue = 0;
/* FUNCTIONS *****************************************************************/
+ULONG FASTCALL
+IntSystemParametersInfo(UINT uiAction, UINT uiParam,PVOID pvParam, UINT fWinIni);
#define ClearMouseInput(mi) \
mi.dx = 0; \
@@ -162,20 +164,18 @@
LARGE_INTEGER CurrentTime;
LARGE_INTEGER DiffTimeMouse;
LARGE_INTEGER DiffTimeKeyboard;
- LARGE_INTEGER OldTimeMouse;
- LARGE_INTEGER OldTimeKeyboard;
+ UINT ScreenSaverTimeOut = 0;
+ BOOL nPreviousState = FALSE;
NTSTATUS Status;
+
KeSetPriorityThread(&PsGetCurrentThread()->Tcb,
LOW_REALTIME_PRIORITY + 3);
KeQuerySystemTime(&MouseInputCurrentTime);
KeQuerySystemTime(&KeyboardInputCurrentTime);
-
- OldTimeMouse.QuadPart = MouseInputCurrentTime.QuadPart;
- OldTimeKeyboard.QuadPart = MouseInputCurrentTime.QuadPart;
-
- DelayTimer.QuadPart = -10000000LL; /* 1 second timeout */
+
+ DelayTimer.QuadPart = -10000000LL; /* 1 second timeout */
for(;;)
{
@@ -188,14 +188,12 @@
DPRINT("Screen Saver auto start Thread Starting...\n");
while(InputThreadsRunning)
{
- /* FIXME
- 1. read timeout value from reg
- 2. read timeout value from spi msg
- */
-
- /* 30 second timeout This value should be read from register */
- Timeout.QuadPart = 300000000LL;
-
+
+ IntSystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &ScreenSaverTimeOut, 0);
+ IntSystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &nPreviousState, 0);
+
+ Timeout.QuadPart = ((LONGLONG)ScreenSaverTimeOut) * 10000000LL;
+
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE,
&DelayTimer);
@@ -211,27 +209,33 @@
KeQuerySystemTime(&CurrentTime);
DiffTimeMouse.QuadPart = CurrentTime.QuadPart - MouseInputCurrentTime.QuadPart;
- DiffTimeKeyboard.QuadPart = CurrentTime.QuadPart - KeyboardInputCurrentTime.QuadPart;
-
- if ( DiffTimeMouse.QuadPart >= Timeout.QuadPart &&
- DiffTimeKeyboard.QuadPart >= Timeout.QuadPart &&
- OldTimeMouse.QuadPart != MouseInputCurrentTime.QuadPart &&
- OldTimeKeyboard.QuadPart != MouseInputCurrentTime.QuadPart)
- {
+ DiffTimeKeyboard.QuadPart = CurrentTime.QuadPart -
KeyboardInputCurrentTime.QuadPart;
+
+ if ( (DiffTimeMouse.QuadPart >= Timeout.QuadPart) &&
+ (DiffTimeKeyboard.QuadPart >= Timeout.QuadPart) &&
+ (nPreviousState == FALSE))
+ {
+ BOOL nPreviousState = FALSE;
DPRINT1("Keyboard and Mouse TimeOut Starting Screen Saver ...\n");
DPRINT1("Keyboard Timeout counter was
%I64d\n",DiffTimeKeyboard.QuadPart);
DPRINT1("Mouse Timeout counter was
%I64d\n",DiffTimeMouse.QuadPart);
- CSR_API_MESSAGE Request;
-
- OldTimeMouse.QuadPart = MouseInputCurrentTime.QuadPart;
- OldTimeKeyboard.QuadPart = MouseInputCurrentTime.QuadPart;
-
+ CSR_API_MESSAGE Request;
CsrInit();
Request.Type = MAKE_CSR_API(START_SCREEN_SAVER, CSR_GUI);
Request.Data.StartScreenSaver.Start = TRUE;
- co_CsrNotifyScreenSaver(&Request );
- }
+ co_CsrNotifyScreenSaver(&Request );
+
+ IntSystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
+ }
+
+ if ( (DiffTimeMouse.QuadPart < Timeout.QuadPart) &&
+ (DiffTimeKeyboard.QuadPart < Timeout.QuadPart) &&
+ (nPreviousState == TRUE))
+ {
+ IntSystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE,
&nPreviousState, 0);
+ }
+
}
DPRINT("Screen Saver auto start Thread Stopped...\n");
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Mon Jul 10 04:26:56 2006
@@ -992,6 +992,12 @@
case SPI_SETDOUBLECLICKTIME:
case SPI_SETDESKWALLPAPER:
case SPI_GETDESKWALLPAPER:
+ case SPI_GETWHEELSCROLLLINES:
+ case SPI_GETWHEELSCROLLCHARS:
+ case SPI_SETSCREENSAVERRUNNING:
+ case SPI_GETSCREENSAVERRUNNING:
+ case SPI_GETSCREENSAVETIMEOUT:
+ case SPI_SETSCREENSAVETIMEOUT:
{
PSYSTEM_CURSORINFO CurInfo;
@@ -1007,6 +1013,29 @@
switch(uiAction)
{
+ case SPI_GETSCREENSAVETIMEOUT:
+ if (pvParam != NULL) *((UINT*)pvParam) = WinStaObject->ScreenSaverTimeOut;
+ return TRUE;
+ case SPI_SETSCREENSAVETIMEOUT:
+ WinStaObject->ScreenSaverTimeOut = uiParam;
+ return TRUE;
+ case SPI_GETSCREENSAVERRUNNING:
+ if (pvParam != NULL) *((BOOL*)pvParam) =
WinStaObject->ScreenSaverRunning;
+ return TRUE;
+ case SPI_SETSCREENSAVERRUNNING:
+ if (pvParam != NULL) *((BOOL*)pvParam) = WinStaObject->ScreenSaverRunning;
+ WinStaObject->ScreenSaverRunning = uiParam;
+ return TRUE;
+ case SPI_GETWHEELSCROLLLINES:
+ CurInfo = IntGetSysCursorInfo(WinStaObject);
+ if (pvParam != NULL) *((UINT*)pvParam) = CurInfo->WheelScroLines;
+ /* FIXME add this value to scroll list as scroll value ?? */
+ return TRUE;
+ case SPI_GETWHEELSCROLLCHARS:
+ CurInfo = IntGetSysCursorInfo(WinStaObject);
+ if (pvParam != NULL) *((UINT*)pvParam) = CurInfo->WheelScroChars;
+ // FIXME add this value to scroll list as scroll value ??
+ break;
case SPI_SETDOUBLECLKWIDTH:
CurInfo = IntGetSysCursorInfo(WinStaObject);
/* FIXME limit the maximum value? */
@@ -1365,6 +1394,12 @@
case SPI_GETGRADIENTCAPTIONS:
case SPI_GETFOCUSBORDERHEIGHT:
case SPI_GETFOCUSBORDERWIDTH:
+ case SPI_GETWHEELSCROLLLINES:
+ case SPI_GETWHEELSCROLLCHARS:
+ case SPI_GETSCREENSAVERRUNNING:
+ case SPI_SETSCREENSAVERRUNNING:
+ case SPI_GETSCREENSAVETIMEOUT:
+ case SPI_SETSCREENSAVETIMEOUT:
{
BOOL Ret;
@@ -1458,6 +1493,11 @@
}
return( TRUE);
}
+ default :
+ {
+ DPRINT1("UserSystemParametersInfo : uiAction = %x \n",uiAction );
+ break;
+ }
}
return( FALSE);
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c Mon Jul 10 04:26:56 2006
@@ -488,6 +488,8 @@
/*
* Initialize the new window station object
*/
+ WindowStationObject->ScreenSaverRunning = FALSE;
+ WindowStationObject->ScreenSaverTimeOut = 30;
if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
{
@@ -504,8 +506,11 @@
CurInfo->LastBtnDown = 0;
CurInfo->CurrentCursorObject = NULL;
CurInfo->ShowingCursor = 0;
-
- /* FIXME: Obtain the following information from the registry */
+
+ CurInfo->WheelScroLines = 3;
+ CurInfo->WheelScroChars = 3;
+
+ /* FIXME: Obtain the following information from the registry */
CurInfo->SwapButtons = FALSE;
CurInfo->DblClickSpeed = 500;
CurInfo->DblClickWidth = 4;