Implemented wxPOWER_RESOURCE_SCREEN for OS X versions < 10.9
This commit is contained in:
@@ -106,8 +106,7 @@ wxEventType wxEVT_POWER_RESUME;
|
|||||||
powering off the screen and Acquire() method can be used to do this.
|
powering off the screen and Acquire() method can be used to do this.
|
||||||
|
|
||||||
Notice that currently this functionality is only implemented for MSW and
|
Notice that currently this functionality is only implemented for MSW and
|
||||||
OS X and on the latter only ::wxPOWER_RESOURCE_SYSTEM is supported for
|
OS X.
|
||||||
versions earlier than 10.9.
|
|
||||||
|
|
||||||
If possible, use wxPowerResourceBlocker class to ensure that Release() is
|
If possible, use wxPowerResourceBlocker class to ensure that Release() is
|
||||||
called instead of calling it manually.
|
called instead of calling it manually.
|
||||||
|
@@ -60,10 +60,16 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason)
|
|||||||
#endif
|
#endif
|
||||||
if ( !g_pmAssertionID )
|
if ( !g_pmAssertionID )
|
||||||
{
|
{
|
||||||
|
CFStringRef assertType;
|
||||||
|
if ( kind == wxPOWER_RESOURCE_SCREEN )
|
||||||
|
assertType = kIOPMAssertionTypeNoDisplaySleep;
|
||||||
|
else
|
||||||
|
assertType = kIOPMAssertionTypeNoIdleSleep;
|
||||||
|
|
||||||
// Use power manager API for < 10.9 systems
|
// Use power manager API for < 10.9 systems
|
||||||
IOReturn success = IOPMAssertionCreateWithName
|
IOReturn success = IOPMAssertionCreateWithName
|
||||||
(
|
(
|
||||||
kIOPMAssertionTypeNoIdleSleep,
|
assertType,
|
||||||
kIOPMAssertionLevelOn,
|
kIOPMAssertionLevelOn,
|
||||||
cfreason,
|
cfreason,
|
||||||
&g_pmAssertionID
|
&g_pmAssertionID
|
||||||
|
Reference in New Issue
Block a user