Backing out bug 475361. untested code. r=ere+dougt

This commit is contained in:
Doug Turner 2009-04-02 14:01:40 -07:00
parent 94ca5d4a92
commit 835b33c191
3 changed files with 8 additions and 38 deletions

View File

@ -43,33 +43,14 @@
NS_IMPL_ISUPPORTS1(nsIdleServiceWin, nsIIdleService)
#ifdef WINCE
// The last user input event time in microseconds. If there are any pending
// native toolkit input events it returns the current time. The value is
// compatible with PR_IntervalToMicroseconds(PR_IntervalNow()).
// DEFINED IN widget/src/windows/nsWindow.cpp
extern PRUint32 gLastInputEventTime;
#endif
NS_IMETHODIMP
nsIdleServiceWin::GetIdleTime(PRUint32 *aTimeDiff)
{
#ifndef WINCE
LASTINPUTINFO inputInfo;
inputInfo.cbSize = sizeof(inputInfo);
if (!::GetLastInputInfo(&inputInfo))
return NS_ERROR_FAILURE;
LASTINPUTINFO inputInfo;
inputInfo.cbSize = sizeof(inputInfo);
if (!::GetLastInputInfo(&inputInfo))
return NS_ERROR_FAILURE;
*aTimeDiff = SAFE_COMPARE_EVEN_WITH_WRAPPING(GetTickCount(), inputInfo.dwTime);
#else
// NOTE: nowTime is not necessarily equivalent to GetTickCount() return value
// we need to compare apples to apples - hence the nowTime variable
PRUint32 nowTime = PR_IntervalToMicroseconds(PR_IntervalNow());
*aTimeDiff = SAFE_COMPARE_EVEN_WITH_WRAPPING(nowTime, gLastInputEventTime);
#endif
return NS_OK;
*aTimeDiff = GetTickCount() - inputInfo.dwTime;
return NS_OK;
}

View File

@ -43,19 +43,11 @@
#include "nsIdleService.h"
/* NOTE: Compare of GetTickCount() could overflow. This corrects for
* overflow situations.
***/
#ifndef SAFE_COMPARE_EVEN_WITH_WRAPPING
#define SAFE_COMPARE_EVEN_WITH_WRAPPING(A, B) (((int)((long)A - (long)B) & 0xFFFFFFFF))
#endif
class nsIdleServiceWin : public nsIdleService
{
public:
NS_DECL_ISUPPORTS
NS_IMETHOD GetIdleTime(PRUint32* idleTime);
};

View File

@ -453,10 +453,7 @@ static BYTE gLastMouseButton = 0;
// The last user input event time in microseconds. If there are any pending
// native toolkit input events it returns the current time. The value is
// compatible with PR_IntervalToMicroseconds(PR_IntervalNow()).
#ifdef WINCE
static
#endif
PRUint32 gLastInputEventTime = 0;
static PRUint32 gLastInputEventTime = 0;
static int gTrimOnMinimize = 2; // uninitialized, but still true