Dealing with Battery Low Warning During Full Screen
I was testing one of my full screen apps last night (while in full screen of course), and I heard the system beep and my app appeared to be frozen until I mouse clicked in the scene. I didn't know what was up so I dropped out of full screen only to see the warning dialog saying that my MacBook was on reserve energy and would go to sleep, yada, yada...
So my app wasn't frozen, it apparently was no longer the key input because a system dialog for the battery came up. This is obviously bad behavior since the user isn't actually notified of what is going on (since they're in full screen), and would have no idea why the app froze either -- I almost tried a force quit myself. What should I do about this?
I did a quick check to see if there were any NSNotifications that might be posted for this condition, but I didn't see any. Did a quick Google and came up with someone else asking the same question, but no responses there...
Also did a quick search at ADC and didn't find anything either. The only thing I stumbled across is the power manager and its various routines. It looks like one could register a procedure for when power is restored or about to shut off (hazy understanding and description here, sorry).
The only idea I have right now is maybe watching for a NSWindowDidResignKeyNotification during full screen and then dump out if that happens? Seems kind of awkward, but maybe it'd work... Probably gonna be a pain in the butt to test this too.
So my app wasn't frozen, it apparently was no longer the key input because a system dialog for the battery came up. This is obviously bad behavior since the user isn't actually notified of what is going on (since they're in full screen), and would have no idea why the app froze either -- I almost tried a force quit myself. What should I do about this?
I did a quick check to see if there were any NSNotifications that might be posted for this condition, but I didn't see any. Did a quick Google and came up with someone else asking the same question, but no responses there...
Also did a quick search at ADC and didn't find anything either. The only thing I stumbled across is the power manager and its various routines. It looks like one could register a procedure for when power is restored or about to shut off (hazy understanding and description here, sorry).The only idea I have right now is maybe watching for a NSWindowDidResignKeyNotification during full screen and then dump out if that happens? Seems kind of awkward, but maybe it'd work... Probably gonna be a pain in the butt to test this too.
It is reasonably easy to watch the battery state yourself, using the power manager. You could compare that value with the dead warning level (you can get it through the power manager as well). I haven't actually checked if that'll work yet, but I'll do so later (shouldn't be a significant change to my current battery status code).
As a side effect, you'll also be able to show the user's battery state while in full screen, something I really like.
As a side effect, you'll also be able to show the user's battery state while in full screen, something I really like.
Hmm... Showing battery level in full screen is not a bad idea, but it still wouldn't address how to know to drop out of full screen when the low battery warning pops up. Apparently this is also an issue with other video games.
Oh, I just found an official Apple article on this:
http://docs.info.apple.com/article.html?...50&coll=cp
Great... Well, it'd still be nice to maybe, possibly find a workaround. I wonder if the dead warning level could be caught at the same time as when the system does it? Ugh... Such a stupid small detail to deal with... If only Apple posted an NSNotification of it, then this would be a snap.
http://docs.info.apple.com/article.html?...50&coll=cp
Great... Well, it'd still be nice to maybe, possibly find a workaround. I wonder if the dead warning level could be caught at the same time as when the system does it? Ugh... Such a stupid small detail to deal with... If only Apple posted an NSNotification of it, then this would be a snap.
The power manager defines a "dead warning level" key for the battery. My guess is that you could just automatically drop out of full screen once the battery level hits this. It wouldn't be a very exact science (I agree, Apple should provide a notification), but it would be better than nothing, I'd guess.
Yeah, I think I'll probably try that later. First I am going to see if NSWindowDidResignKeyNotification will do the trick. Still two and a half hours left on this battery though, so it'll be a while before I can find out... Hopefully I'll remember to put my test app into full screen at about the right time.
Yes, NSWindowDidResignKeyNotification works for this! Woohoo! 
Anyway, maybe I'll still do the battery level in full screen. It's not on my priority list, but I never thought about it until you brought it up, and it seems like a really handy feature. Thanks for the input on this

Anyway, maybe I'll still do the battery level in full screen. It's not on my priority list, but I never thought about it until you brought it up, and it seems like a really handy feature. Thanks for the input on this
Neat!
* ThemsAllTook adds to "fully polished product" checklist
* ThemsAllTook adds to "fully polished product" checklist
ThemsAllTook Wrote:Neat!
* OneSadCookie adds to "fully polished product" checklist
If you actually have such a thing, perhaps you could post it for our edification, discussion and addition
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Is Dealing with Opengl ES 2 worth the trouble? | Mattonaise | 9 | 7,130 |
Aug 23, 2011 08:56 PM Last Post: Mattonaise |
|
| Dealing with inverted textures in OpenGL | johncmurphy | 7 | 5,859 |
Jun 15, 2009 08:11 AM Last Post: Skorche |
|
| Full Screen OpenGL Crashes | Blacktiger | 13 | 6,533 |
Feb 19, 2009 02:39 PM Last Post: backslash |
|
| OpenGL full screen mode leaves garbage on screen when exiting app | Malarkey | 5 | 4,458 |
Nov 19, 2008 12:51 PM Last Post: Malarkey |
|
| Dealing with GLUT and OpenGL... | RingoEST | 10 | 4,928 |
Aug 16, 2008 12:24 AM Last Post: RingoEST |
|

