mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:11:44 +00:00
Change in the auto screen saver startup code in win32k
1. Fixing allot better sync for the timeout counter 2. Change the hard code value to 30 sec instead for 15 sec 3. The start of screen saver are 30.0 sec to 30.9 sec for we can not start on exactly on the x.0 sec but betwin svn path=/trunk/; revision=22900
This commit is contained in:
parent
6f734d6123
commit
be4f6702f4
1 changed files with 50 additions and 22 deletions
|
@ -41,6 +41,8 @@ extern BYTE gQueueKeyStateTable[];
|
|||
|
||||
static HANDLE ScreenSaverThreadHandle;
|
||||
static CLIENT_ID ScreenSaverThreadId;
|
||||
static LARGE_INTEGER MouseInputCurrentTime;
|
||||
static LARGE_INTEGER KeyboardInputCurrentTime;
|
||||
|
||||
static HANDLE MouseDeviceHandle;
|
||||
static HANDLE MouseThreadHandle;
|
||||
|
@ -50,7 +52,6 @@ static CLIENT_ID KeyboardThreadId;
|
|||
static HANDLE KeyboardDeviceHandle;
|
||||
static KEVENT InputThreadsStart;
|
||||
static BOOLEAN InputThreadsRunning = FALSE;
|
||||
static BOOLEAN ScreenSaverRunning = FALSE;
|
||||
PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue = 0;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -157,11 +158,25 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
{
|
||||
KEVENT Event;
|
||||
LARGE_INTEGER Timeout;
|
||||
LARGE_INTEGER DelayTimer;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER DiffTimeMouse;
|
||||
LARGE_INTEGER DiffTimeKeyboard;
|
||||
LARGE_INTEGER OldTimeMouse;
|
||||
LARGE_INTEGER OldTimeKeyboard;
|
||||
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 */
|
||||
|
||||
for(;;)
|
||||
{
|
||||
DPRINT("Screen Saver auto start Thread Waiting for start event\n");
|
||||
|
@ -172,17 +187,17 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
NULL);
|
||||
DPRINT("Screen Saver auto start Thread Starting...\n");
|
||||
while(InputThreadsRunning)
|
||||
{
|
||||
NTSTATUS OldStatus;
|
||||
{
|
||||
/* FIXME
|
||||
1. read timeout value from reg
|
||||
2. read timeout value from spi msg
|
||||
*/
|
||||
OldStatus = STATUS_SUCCESS;
|
||||
|
||||
Timeout.QuadPart = -150000000LL; /* 15 second timeout */
|
||||
|
||||
/* 30 second timeout This value should be read from register */
|
||||
Timeout.QuadPart = 300000000LL;
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &Timeout);
|
||||
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &DelayTimer);
|
||||
|
||||
if(Status == STATUS_ALERTED && !InputThreadsRunning)
|
||||
{
|
||||
|
@ -193,18 +208,31 @@ ScreenSaverThreadMain(PVOID StartContext)
|
|||
DPRINT1("Win32K: Failed to read from Screen Saver auto thread.\n");
|
||||
return; //(Status);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
if ((Status == STATUS_TIMEOUT) && (ScreenSaverRunning == FALSE))
|
||||
{
|
||||
DPRINT1("Keyboard and Mouse TimeOut Starting Screen Saver...\n");
|
||||
CSR_API_MESSAGE Request;
|
||||
ScreenSaverRunning = TRUE;
|
||||
CsrInit();
|
||||
Request.Type = MAKE_CSR_API(START_SCREEN_SAVER, CSR_GUI);
|
||||
Request.Data.StartScreenSaver.Start = TRUE;
|
||||
co_CsrNotifyScreenSaver(&Request );
|
||||
}
|
||||
OldTimeMouse.QuadPart = MouseInputCurrentTime.QuadPart;
|
||||
OldTimeKeyboard.QuadPart = MouseInputCurrentTime.QuadPart;
|
||||
|
||||
CsrInit();
|
||||
Request.Type = MAKE_CSR_API(START_SCREEN_SAVER, CSR_GUI);
|
||||
Request.Data.StartScreenSaver.Start = TRUE;
|
||||
co_CsrNotifyScreenSaver(&Request );
|
||||
}
|
||||
|
||||
}
|
||||
DPRINT("Screen Saver auto start Thread Stopped...\n");
|
||||
}
|
||||
|
@ -286,8 +314,8 @@ MouseThreadMain(PVOID StartContext)
|
|||
}
|
||||
DPRINT("MouseEvent\n");
|
||||
|
||||
ScreenSaverRunning = FALSE;
|
||||
|
||||
KeQuerySystemTime(&MouseInputCurrentTime);
|
||||
|
||||
UserEnterExclusive();
|
||||
|
||||
ProcessMouseInputData(&MouseInput, Iosb.Information / sizeof(MOUSE_INPUT_DATA));
|
||||
|
@ -596,7 +624,7 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
return; //(Status);
|
||||
}
|
||||
|
||||
ScreenSaverRunning = FALSE;
|
||||
KeQuerySystemTime(&KeyboardInputCurrentTime);
|
||||
|
||||
/* Update modifier state */
|
||||
fsModifiers = IntKeyboardGetModifiers(&KeyInput);
|
||||
|
@ -845,7 +873,7 @@ NTSTATUS FASTCALL
|
|||
InitInputImpl(VOID)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
KeInitializeEvent(&InputThreadsStart, NotificationEvent, FALSE);
|
||||
|
||||
Status = PsCreateSystemThread(&KeyboardThreadHandle,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue