mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
PlatformMisc: Fix screensaver inhibition on macOS (#3674)
This commit is contained in:
@@ -34,7 +34,7 @@ static bool SetScreensaverInhibitMacOS(bool inhibit)
|
||||
{
|
||||
if (inhibit)
|
||||
{
|
||||
const CFStringRef reason = CFSTR("System Running");
|
||||
const CFStringRef reason = CFSTR("DuckStation System Running");
|
||||
if (IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, reason,
|
||||
&s_prevent_idle_assertion) != kIOReturnSuccess)
|
||||
{
|
||||
@@ -52,17 +52,18 @@ static bool SetScreensaverInhibitMacOS(bool inhibit)
|
||||
}
|
||||
}
|
||||
|
||||
static bool s_screensaver_suspended;
|
||||
static bool s_screensaver_suspended = false;
|
||||
|
||||
void PlatformMisc::SuspendScreensaver()
|
||||
{
|
||||
if (s_screensaver_suspended)
|
||||
return;
|
||||
|
||||
if (!SetScreensaverInhibitMacOS(true))
|
||||
{
|
||||
ERROR_LOG("Failed to suspend screensaver.");
|
||||
return;
|
||||
}
|
||||
if (!SetScreensaverInhibitMacOS(true))
|
||||
{
|
||||
ERROR_LOG("Failed to suspend screensaver.");
|
||||
return;
|
||||
}
|
||||
|
||||
s_screensaver_suspended = true;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ static bool SetScreensaverInhibit(bool inhibit)
|
||||
return SetScreensaverInhibitDBus(inhibit, "DuckStation", "DuckStation VM is running.");
|
||||
}
|
||||
|
||||
static bool s_screensaver_suspended;
|
||||
static bool s_screensaver_suspended = false;
|
||||
|
||||
void PlatformMisc::SuspendScreensaver()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user