2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
|
|
|
*/
|
2012-05-21 04:12:37 -07: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-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIdleServiceWin.h"
|
|
|
|
#include <windows.h>
|
|
|
|
|
2012-06-29 01:32:21 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceWin, nsIdleService)
|
2009-04-14 11:23:01 -07:00
|
|
|
|
2010-04-16 10:37:16 -07:00
|
|
|
bool
|
|
|
|
nsIdleServiceWin::PollIdleTime(PRUint32 *aIdleTime)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-04-02 14:01:40 -07:00
|
|
|
LASTINPUTINFO inputInfo;
|
|
|
|
inputInfo.cbSize = sizeof(inputInfo);
|
|
|
|
if (!::GetLastInputInfo(&inputInfo))
|
2010-04-16 10:37:16 -07:00
|
|
|
return false;
|
2009-04-14 11:23:01 -07:00
|
|
|
|
2010-04-16 10:37:16 -07:00
|
|
|
*aIdleTime = SAFE_COMPARE_EVEN_WITH_WRAPPING(GetTickCount(), inputInfo.dwTime);
|
2009-04-14 11:23:01 -07:00
|
|
|
|
2010-04-16 10:37:16 -07:00
|
|
|
return true;
|
|
|
|
}
|
2010-03-31 07:07:14 -07:00
|
|
|
|
2010-04-16 10:37:16 -07:00
|
|
|
bool
|
|
|
|
nsIdleServiceWin::UsePollMode()
|
|
|
|
{
|
|
|
|
return true;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|