Stop using deprecated UpdateSystemActivity() on mac.
This commit is contained in:
parent
27f60c281e
commit
d2bb2d7ac8
|
@ -825,7 +825,6 @@ optional_source(APPLE
|
|||
core/macfslistener.h
|
||||
core/macglobalshortcutbackend.h
|
||||
devices/macdevicelister.h
|
||||
ui/macscreensaver.h
|
||||
ui/macsystemtrayicon.h
|
||||
)
|
||||
|
||||
|
|
|
@ -17,24 +17,20 @@
|
|||
|
||||
#include "macscreensaver.h"
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
MacScreensaver::MacScreensaver() {
|
||||
timer_.setInterval(30000);
|
||||
connect(&timer_, SIGNAL(timeout()), SLOT(Timeout()));
|
||||
}
|
||||
|
||||
void MacScreensaver::Timeout() {
|
||||
UpdateSystemActivity(OverallAct);
|
||||
MacScreensaver::MacScreensaver()
|
||||
: assertion_id_(0) {
|
||||
}
|
||||
|
||||
void MacScreensaver::Inhibit() {
|
||||
timer_.start(30000);
|
||||
Timeout();
|
||||
IOPMAssertionCreateWithName(
|
||||
kIOPMAssertionTypePreventUserIdleDisplaySleep,
|
||||
kIOPMAssertionLevelOn,
|
||||
CFSTR("Showing full-screen Clementine visualisations"),
|
||||
&assertion_id_);
|
||||
}
|
||||
|
||||
void MacScreensaver::Uninhibit() {
|
||||
timer_.stop();
|
||||
IOPMAssertionRelease(assertion_id_);
|
||||
}
|
||||
|
|
|
@ -20,21 +20,17 @@
|
|||
|
||||
#include "screensaver.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||
|
||||
class MacScreensaver : public QObject, public Screensaver {
|
||||
Q_OBJECT
|
||||
class MacScreensaver : public Screensaver {
|
||||
public:
|
||||
MacScreensaver();
|
||||
|
||||
void Inhibit();
|
||||
void Uninhibit();
|
||||
|
||||
private slots:
|
||||
void Timeout();
|
||||
|
||||
private:
|
||||
QTimer timer_;
|
||||
IOPMAssertionID assertion_id_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue