FROM : Andrew Farmer
DATE : Sat Nov 03 23:22:37 2007
On 30 Oct 07, at 15:33, Andrew James wrote:
> I noticed steve added the nice feature to sleep the display via a hot
> corner, but is there a way for us devs to hook into it? I am
> currently using
> a pmset hack which i would prefer to use a cleaner method
Undocumented, use at your own risk, etc. It ends up involving more
IOKit than Cocoa, as it turns out.
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
int dimDisplayNow(void) {
io_registry_entry_t r =
IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/
IODisplayWrangler");
if(!r) return 1;
int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"),
kCFBooleanTrue);
IOObjectRelease(r);
return err;
}
DATE : Sat Nov 03 23:22:37 2007
On 30 Oct 07, at 15:33, Andrew James wrote:
> I noticed steve added the nice feature to sleep the display via a hot
> corner, but is there a way for us devs to hook into it? I am
> currently using
> a pmset hack which i would prefer to use a cleaner method
Undocumented, use at your own risk, etc. It ends up involving more
IOKit than Cocoa, as it turns out.
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
int dimDisplayNow(void) {
io_registry_entry_t r =
IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/
IODisplayWrangler");
if(!r) return 1;
int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"),
kCFBooleanTrue);
IOObjectRelease(r);
return err;
}
| Related mails | Author | Date |
|---|---|---|
| Andrew James | Oct 30, 23:33 | |
| Andrew Farmer | Nov 3, 23:22 | |
| Andrew James | Nov 4, 07:45 | |
| Jere Gmail | May 11, 10:59 | |
| Jens Alfke | May 11, 17:20 |






Cocoa mail archive

