Open
Bug 1307538
Opened 8 years ago
Updated 3 months ago
Expose a nsIIdleService-like for user events
Categories
(Core :: Widget, defect, P5)
Core
Widget
Tracking
()
NEW
People
(Reporter: Yoric, Unassigned)
References
Details
(Whiteboard: tpi:+)
According to the documentation of nsIIdleService, it exposes the duration for which the entire OS has been idle. In many cases, it would be more interesting to know how many seconds since the user has last been active in the application. The information is mostly available internally through the following: mozilla::EventStateManager::LatestUserInputStart()
Comment 1•8 years ago
|
||
nsIdleService already supports app wide idle time if it's not using polling mode. I think we could make nsIdleService support both modes by adding a new flag to nsIIdleService::AddIdleObserver to choose app-wide or system-wide idle timer.
Reporter | ||
Comment 2•8 years ago
|
||
Good idea. I don't think we can add optional arguments in XPCOM, so this means either adding a new method pair `addIdleObserver2`/ `removeIdleObserver2` or being creative (e.g. use negative durations for event-idle).
Comment 3•8 years ago
|
||
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #2) > Good idea. I don't think we can add optional arguments in XPCOM, so this > means either adding a new method pair `addIdleObserver2`/ > `removeIdleObserver2` or being creative (e.g. use negative durations for > event-idle). Actually you can use [optional] in XPCOM so we can use the same method name.
Reporter | ||
Comment 4•8 years ago
|
||
Mmmh... I'm looking at nsIdleService, and while I see claims that it's listening for application events, I don't find any code backing that claim. What am I missing?
Reporter | ||
Comment 5•8 years ago
|
||
> Actually you can use [optional] in XPCOM so we can use the same method name.
(ah, right, long time no XPIDL)
Flags: needinfo?(kchen)
Comment 6•8 years ago
|
||
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #4) > Mmmh... I'm looking at nsIdleService, and while I see claims that it's > listening for application events, I don't find any code backing that claim. > What am I missing? It uses nsIIdleServiceInternal::ResetIdleTimeout to record input events in widget event handler [1] http://searchfox.org/mozilla-central/search?q=ResetIdleTimeout&case=false®exp=false&path= [2] http://searchfox.org/mozilla-central/rev/76609a05d6ef7ba4223ed79e479c73fb2543a107/widget/nsIdleService.cpp#528 and here it computes the idle time based on the last input event [3] http://searchfox.org/mozilla-central/rev/76609a05d6ef7ba4223ed79e479c73fb2543a107/widget/nsIdleService.cpp#632-637 [4] http://searchfox.org/mozilla-central/rev/76609a05d6ef7ba4223ed79e479c73fb2543a107/widget/nsIdleService.cpp#672-687 I think we need to extract that to two classes and use them in nsIdleService nsIdleService <--+----- nsAppIdleService | `----- nsSystemIdleService And make AddIdleObserver queue observers to the appropriate service.
Flags: needinfo?(kchen)
Updated•8 years ago
|
Component: Performance Monitoring → Widget
Product: Toolkit → Core
Updated•8 years ago
|
Priority: -- → P5
Whiteboard: tpi:+
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•