Hi, ________________________________________ From: maemo-developers-boun...@maemo.org [maemo-developers-boun...@maemo.org] On Behalf Of Hamalainen Kimmo (Nokia-D/Helsinki)
On Wed, 2009-03-25 at 09:14 +0100, Hamalainen Kimmo (Nokia-D/Helsinki) > > I would like to detect when an SDL application gets iconified. Than I > > can pause it to save power. In theory the SDL_ACTIVEEVENT should be > > generated and event.active should give me the info I need however I do > > not get these type of events. Note that it's not enough just to use SDL function to wait for events when it's invisible / idle. SDL does 10Hz polling even when waiting for events which will drain battery pretty soon. (I filed a bug about that for upstream SDL several years ago, it's still not fixed, but there's a broken patch available.) Because of this, in my own SDL code I use select() when the process should be idle in RAM longer times without draining battery. You can get the SDL X socket file descriptor like this: -------------- /** * Return the X connection socket or zero */ static int GetUISocket(void) { SDL_SysWMinfo info; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { return 0; } return ConnectionNumber(info.info.x11.display); } ------------ Your program could use something like that also with an an explicit (user invoked) pause functionality. - Eero _______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers