1 #pragma once
2 
3 #ifdef Q_OS_MAC
4 #include <IOKit/pwr_mgt/IOPMLib.h>
5 #endif // Q_OS_MAC
6 
7 namespace mixxx {
8 
9 // Code related to interacting with the screensaver.
10 //
11 // Main use is to prevent the screensaver from starting if Mixxx is being used.
12 //
13 class ScreenSaverHelper {
14 public:
15 
16    static void inhibit();
17    static void uninhibit();
18    static void triggerUserActivity();
19 
20 private:
21    static void inhibitInternal();
22    static void uninhibitInternal();
23 
24    static bool s_enabled;
25    static bool s_sendActivity;
26 #if defined(Q_OS_MAC)
27     /* sleep management */
28     static IOPMAssertionID s_systemSleepAssertionID;
29     static IOPMAssertionID s_userActivityAssertionID;
30 #elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
31     static uint32_t s_cookie;
32     static int s_saverindex;
33 #endif // Q_OS_MAC
34 };
35 
36 }
37