Skip to content

Commit

Permalink
QMPlay2: fix for 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed May 10, 2024
1 parent 8f8e180 commit 852e90e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,30 @@ diff --git src/gui/macOS/ScreenSaver.cpp src/gui/macOS/ScreenSaver.cpp
index de305ff9..13a22ac2 100644
--- src/gui/macOS/ScreenSaver.cpp
+++ src/gui/macOS/ScreenSaver.cpp
@@ -32,8 +32,8 @@ public:
@@ -20,6 +20,10 @@

#include <IOKit/pwr_mgt/IOPMLib.h>

+#ifdef __APPLE__
+ #include <AvailabilityMacros.h>
+#endif
+
#define QMPLAY2_MEDIA_PLAYBACK CFSTR("QMPlay2 media playback")

class ScreenSaverPriv
@@ -32,8 +36,13 @@

inline void inhibit()
{
- m_okDisp = (IOPMAssertionCreateWithName(kIOPMAssertPreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, QMPLAY2_MEDIA_PLAYBACK, &m_idDisp) == kIOReturnSuccess);
- m_okSys = (IOPMAssertionCreateWithName(kIOPMAssertPreventUserIdleSystemSleep, kIOPMAssertionLevelOn, QMPLAY2_MEDIA_PLAYBACK, &m_idSys) == kIOReturnSuccess);
+#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)
+ m_okDisp = (IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &m_idDisp) == kIOReturnSuccess);
+ m_okSys = (IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &m_idSys) == kIOReturnSuccess);
+#else
+ m_okDisp = (IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, QMPLAY2_MEDIA_PLAYBACK, &m_idDisp) == kIOReturnSuccess);
+ m_okSys = (IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, QMPLAY2_MEDIA_PLAYBACK, &m_idSys) == kIOReturnSuccess);
+#endif
}
inline void unInhibit()
{

0 comments on commit 852e90e

Please sign in to comment.