Stop using deprecated UpdateSystemActivity() on mac.

This commit is contained in:
John Maguire 2012-10-24 16:45:00 +02:00
parent 27f60c281e
commit d2bb2d7ac8
3 changed files with 11 additions and 20 deletions

View File

@ -825,7 +825,6 @@ optional_source(APPLE
core/macfslistener.h
core/macglobalshortcutbackend.h
devices/macdevicelister.h
ui/macscreensaver.h
ui/macsystemtrayicon.h
)

View File

@ -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_);
}

View File

@ -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