Sleep notification on osx

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
scottb
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Sep 20, 2010 6:53 pm

Sleep notification on osx

Post by scottb » Fri Mar 11, 2016 1:38 am

I have my program successfully getting sleep notifications on msw.

I need to get it working on osx. I found this:
https://developer.apple.com/library/mac ... index.html

and listing 3 is what I'm looking for. I just need to delay sleep for a moment to cleanly
shutdown my server connections.

It's straight forward to the point of registering it with the event loop and then
calling the event loop.

I don't understand mac or wxwidgets events/loops. Here is the apple code to
register with the event loop:

// add the notification port to the application runloop
CFRunLoopAddSource( CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes );

will this work with wxWidgets? can i call it from OnInit?

Post Reply