feat(Metal): Add support to disable display sleep (no screen saver)
This commit is contained in:
parent
a19ea2ed07
commit
c7b21d5bd6
|
@ -60,6 +60,10 @@ typedef enum apple_view_type {
|
||||||
/*! @brief setCursorVisible specifies whether the cursor is visible */
|
/*! @brief setCursorVisible specifies whether the cursor is visible */
|
||||||
- (void)setCursorVisible:(bool)v;
|
- (void)setCursorVisible:(bool)v;
|
||||||
|
|
||||||
|
/*! @brief controls whether the screen saver should be disabled and
|
||||||
|
* the displays should not sleep.
|
||||||
|
*/
|
||||||
|
- (bool)setDisableDisplaySleep:(bool)disable;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern id<ApplePlatform> apple_platform;
|
extern id<ApplePlatform> apple_platform;
|
||||||
|
|
|
@ -53,6 +53,8 @@ id<ApplePlatform> apple_platform;
|
||||||
NSWindow* _window;
|
NSWindow* _window;
|
||||||
apple_view_type_t _vt;
|
apple_view_type_t _vt;
|
||||||
NSView* _renderView;
|
NSView* _renderView;
|
||||||
|
id _sleepActivity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
||||||
|
@ -337,6 +339,26 @@ static char** waiting_argv;
|
||||||
[NSCursor hide];
|
[NSCursor hide];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (bool)setDisableDisplaySleep:(bool)disable
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
|
||||||
|
if (disable && _sleepActivity == nil)
|
||||||
|
{
|
||||||
|
_sleepActivity = [NSProcessInfo.processInfo beginActivityWithOptions:NSActivityIdleDisplaySleepDisabled reason:@"disable screen saver"];
|
||||||
|
}
|
||||||
|
else if (!disable && _sleepActivity != nil)
|
||||||
|
{
|
||||||
|
[NSProcessInfo.processInfo endActivity:_sleepActivity];
|
||||||
|
_sleepActivity = nil;
|
||||||
|
}
|
||||||
|
return YES;
|
||||||
|
#else
|
||||||
|
return NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) rarch_main
|
- (void) rarch_main
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in New Issue