From d67db4e3846cbd5d5000fe48b818c42bb93b85df Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Wed, 26 Mar 2003 05:23:13 +0000 Subject: [PATCH] #194571 r=pedemont, sr=blizzard (platform specific) OS/2 only - Implement GetLastInputEventTime git-svn-id: svn://10.0.0.236/trunk@140338 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/os2/nsWindow.cpp | 20 ++++++++++++++++++++ mozilla/widget/src/os2/nsWindow.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/mozilla/widget/src/os2/nsWindow.cpp b/mozilla/widget/src/os2/nsWindow.cpp index 6126a15dbdd..2cb6a415ccf 100644 --- a/mozilla/widget/src/os2/nsWindow.cpp +++ b/mozilla/widget/src/os2/nsWindow.cpp @@ -140,6 +140,11 @@ extern "C" { ULONG Address); } +// The last user input event time in milliseconds. If there are any pending +// native toolkit input events it returns the current time. The value is +// compatible with PR_IntervalToMicroseconds(PR_IntervalNow()). +static PRUint32 gLastInputEventTime = 0; + #ifdef DEBUG_FOCUS static int currentWindowIdentifier = 0; #endif @@ -3327,6 +3332,21 @@ NS_METHOD nsWindow::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) return NS_OK; } +NS_IMETHODIMP +nsWindow::GetLastInputEventTime(PRUint32& aTime) +{ + ULONG ulStatus = WinQueryQueueStatus(HWND_DESKTOP); + + // If there is pending input then return the current time. + if (ulStatus && (QS_KEY | QS_MOUSE | QS_MOUSEBUTTON | QS_MOUSEMOVE)) { + gLastInputEventTime = PR_IntervalToMicroseconds(PR_IntervalNow()); + } + + aTime = gLastInputEventTime; + + return NS_OK; +} + // -------------------------------------------------------------------------- // OS2-specific routines to emulate Windows behaviors // -------------------------------------------------------------------------- diff --git a/mozilla/widget/src/os2/nsWindow.h b/mozilla/widget/src/os2/nsWindow.h index eacec4df9ae..0c4474e58fc 100644 --- a/mozilla/widget/src/os2/nsWindow.h +++ b/mozilla/widget/src/os2/nsWindow.h @@ -137,6 +137,8 @@ class nsWindow : public nsBaseWidget, NS_IMETHOD DispatchEvent( struct nsGUIEvent *event, nsEventStatus &aStatus); NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent); + NS_IMETHOD GetLastInputEventTime(PRUint32& aTime); + // Widget appearance virtual nsIFontMetrics *GetFont(); NS_IMETHOD SetFont( const nsFont &aFont);