mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
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 */
|
||||
- (void)setCursorVisible:(bool)v;
|
||||
|
||||
/*! @brief controls whether the screen saver should be disabled and
|
||||
* the displays should not sleep.
|
||||
*/
|
||||
- (bool)setDisableDisplaySleep:(bool)disable;
|
||||
@end
|
||||
|
||||
extern id<ApplePlatform> apple_platform;
|
||||
|
@ -53,6 +53,8 @@ id<ApplePlatform> apple_platform;
|
||||
NSWindow* _window;
|
||||
apple_view_type_t _vt;
|
||||
NSView* _renderView;
|
||||
id _sleepActivity;
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
||||
@ -337,6 +339,26 @@ static char** waiting_argv;
|
||||
[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
|
||||
{
|
||||
do
|
||||
|
Loading…
x
Reference in New Issue
Block a user