[maemo-developers] Optimal battery life considerations in apps
From: Kimmo Hämäläinen kimmo.hamalainen at nokia.comDate: Fri Jul 24 12:57:12 EEST 2009
- Previous message: Optimal battery life considerations in apps
- Next message: Optimal battery life considerations in apps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 2009-07-24 at 10:54 +0200, ext Andrew Flegg wrote: > On Fri, Jul 24, 2009 at 07:55, daniel wilms<daniel.wilms at nokia.com> wrote: > > > > there is an API to detect if the window is in the foreground or not (thx to Kimmo > > for pointing me to this) [1]. If this property is true, then the window is visible > > on the screen. You can use this parameter directly from your root window. And here Not "your root window", but "the root window". The property in the root window is _MB_CURRENT_APP_WINDOW and is-topmost in libhildon tracks that property. > > [2] you find the method to get the value of the parameter. > > Yup, indeed. (PyMaemo doesn't expose the method, but you can get the property). > > However, what's the best way of detecting when you come *back* to the > foreground? I didn't get a property-change event (although this could > be due to a PyMaemo bug rather than a Hildon one). The property changes to true when you come back to foreground. Only in the visible HildonWindow, of course (in case you have a stack of windows). > My basic code structure is: > > * while timer fires: > - check is-topmost > - if false, cancel timer and return > - update screen > > * when receiving focus-in event: > - check is-topmost > - if true, re-initialise timer > > * when osso signal for power state received: > - cancel, or re-initialise, timer as appropriate > > This works fine on Diablo (can't test on Fremantle due to no app > switching). The "focus-in" bit seems a bit hacky, though. But if > there's no better way which the Hildon developers/Nokia recommend, > that's fine by me. Probably Python bindings are confused then. You don't need any timers to use it. -Kimmo > > Cheers, > > Andrew >
- Previous message: Optimal battery life considerations in apps
- Next message: Optimal battery life considerations in apps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]