mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
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. svn path=/trunk/; revision=22985
This commit is contained in:
parent
f89c0df588
commit
52c172d21e
5 changed files with 86 additions and 30 deletions
|
@ -38,6 +38,8 @@ typedef struct _SYSTEM_CURSORINFO
|
|||
UINT ButtonsDown;
|
||||
CURSORCLIP_INFO CursorClipInfo;
|
||||
PCURICON_OBJECT CurrentCursorObject;
|
||||
UINT WheelScroLines;
|
||||
UINT WheelScroChars;
|
||||
BYTE ShowingCursor;
|
||||
UINT DblClickSpeed;
|
||||
UINT DblClickWidth;
|
||||
|
@ -46,6 +48,7 @@ typedef struct _SYSTEM_CURSORINFO
|
|||
LONG LastBtnDownX;
|
||||
LONG LastBtnDownY;
|
||||
HANDLE LastClkWnd;
|
||||
BOOL ScreenSaverRunning;
|
||||
} SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO;
|
||||
|
||||
HCURSOR FASTCALL IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange);
|
||||
|
|
|
@ -33,6 +33,10 @@ typedef struct _WINSTATION_OBJECT
|
|||
HANDLE ShellWindow;
|
||||
HANDLE ShellListView;
|
||||
|
||||
/* ScreenSaver */
|
||||
BOOL ScreenSaverRunning;
|
||||
UINT ScreenSaverTimeOut;
|
||||
|
||||
/* Wallpaper */
|
||||
HANDLE hbmWallpaper;
|
||||
ULONG cxWallpaper, cyWallpaper;
|
||||
|
|
|
@ -55,6 +55,8 @@ static BOOLEAN InputThreadsRunning = FALSE;
|
|||
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 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
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 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
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 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
|
||||
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");
|
||||
|
|
|
@ -992,6 +992,12 @@ IntSystemParametersInfo(
|
|||
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 @@ IntSystemParametersInfo(
|
|||
|
||||
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 @@ UserSystemParametersInfo(
|
|||
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 @@ UserSystemParametersInfo(
|
|||
}
|
||||
return( TRUE);
|
||||
}
|
||||
default :
|
||||
{
|
||||
DPRINT1("UserSystemParametersInfo : uiAction = %x \n",uiAction );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return( FALSE);
|
||||
}
|
||||
|
|
|
@ -488,6 +488,8 @@ NtUserCreateWindowStation(
|
|||
/*
|
||||
* Initialize the new window station object
|
||||
*/
|
||||
WindowStationObject->ScreenSaverRunning = FALSE;
|
||||
WindowStationObject->ScreenSaverTimeOut = 30;
|
||||
|
||||
if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
|
||||
{
|
||||
|
@ -504,8 +506,11 @@ NtUserCreateWindowStation(
|
|||
CurInfo->LastBtnDown = 0;
|
||||
CurInfo->CurrentCursorObject = NULL;
|
||||
CurInfo->ShowingCursor = 0;
|
||||
|
||||
CurInfo->WheelScroLines = 3;
|
||||
CurInfo->WheelScroChars = 3;
|
||||
|
||||
/* FIXME: Obtain the following information from the registry */
|
||||
/* FIXME: Obtain the following information from the registry */
|
||||
CurInfo->SwapButtons = FALSE;
|
||||
CurInfo->DblClickSpeed = 500;
|
||||
CurInfo->DblClickWidth = 4;
|
||||
|
|
Loading…
Reference in a new issue