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