2007-01-26 00:13:32 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-01-26 00:13:32 +03:00
|
|
|
|
|
|
|
#include "nsIdleServiceWin.h"
|
|
|
|
#include <windows.h>
|
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceWin, nsIdleService)
|
2009-04-14 22:23:01 +04:00
|
|
|
|
2010-04-16 21:37:16 +04:00
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIdleServiceWin::PollIdleTime(uint32_t *aIdleTime)
|
2007-01-26 00:13:32 +03:00
|
|
|
{
|
2009-04-03 01:01:40 +04:00
|
|
|
LASTINPUTINFO inputInfo;
|
|
|
|
inputInfo.cbSize = sizeof(inputInfo);
|
|
|
|
if (!::GetLastInputInfo(&inputInfo))
|
2010-04-16 21:37:16 +04:00
|
|
|
return false;
|
2009-04-14 22:23:01 +04:00
|
|
|
|
2010-04-16 21:37:16 +04:00
|
|
|
*aIdleTime = SAFE_COMPARE_EVEN_WITH_WRAPPING(GetTickCount(), inputInfo.dwTime);
|
2009-04-14 22:23:01 +04:00
|
|
|
|
2010-04-16 21:37:16 +04:00
|
|
|
return true;
|
|
|
|
}
|
2010-03-31 18:07:14 +04:00
|
|
|
|
2010-04-16 21:37:16 +04:00
|
|
|
bool
|
|
|
|
nsIdleServiceWin::UsePollMode()
|
|
|
|
{
|
|
|
|
return true;
|
2007-01-26 00:13:32 +03:00
|
|
|
}
|