1
0
Fork 0

[Backend/Utils] Added screensaver resetting whilst playing.

This commit is contained in:
NamedKitten 2018-11-21 08:03:28 +00:00
parent bd41d19d24
commit d5f4ab408f
4 changed files with 16 additions and 2 deletions

View file

@ -501,6 +501,7 @@ DirectMpvPlayerBackend::handle_mpv_event(mpv_event* event)
if (prop->format == MPV_FORMAT_DOUBLE) { if (prop->format == MPV_FORMAT_DOUBLE) {
double time = *(double*)prop->data; double time = *(double*)prop->data;
emit positionChanged(time); emit positionChanged(time);
Utils::ResetScreensaver();
} }
} else if (strcmp(prop->name, "duration") == 0) { } else if (strcmp(prop->name, "duration") == 0) {
if (prop->format == MPV_FORMAT_DOUBLE) { if (prop->format == MPV_FORMAT_DOUBLE) {

View file

@ -468,6 +468,7 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event)
if (prop->format == MPV_FORMAT_DOUBLE) { if (prop->format == MPV_FORMAT_DOUBLE) {
double time = *(double*)prop->data; double time = *(double*)prop->data;
emit positionChanged(time); emit positionChanged(time);
Utils::ResetScreensaver();
} }
} else if (strcmp(prop->name, "duration") == 0) { } else if (strcmp(prop->name, "duration") == 0) {
if (prop->format == MPV_FORMAT_DOUBLE) { if (prop->format == MPV_FORMAT_DOUBLE) {

View file

@ -59,7 +59,6 @@ createTimestamp(int seconds)
void void
SetDPMS(bool on) SetDPMS(bool on)
{ {
qDebug() << getPlatformName();
if (getPlatformName() != "xcb") { if (getPlatformName() != "xcb") {
return; return;
} }
@ -72,11 +71,16 @@ SetDPMS(bool on)
qDebug() << "Disabled DPMS."; qDebug() << "Disabled DPMS.";
} }
} }
void
ResetScreensaver()
{
Display* display = QX11Info::display();
XResetScreenSaver(display);
}
void void
AlwaysOnTop(WId wid, bool on) AlwaysOnTop(WId wid, bool on)
{ {
qDebug() << "On Top:" << on;
Display* display = QX11Info::display(); Display* display = QX11Info::display();
XEvent event; XEvent event;
event.xclient.type = ClientMessage; event.xclient.type = ClientMessage;
@ -114,5 +118,11 @@ SetDPMS(bool on)
qDebug() << "Can't set DPMS for platform: " << getPlatformName(); qDebug() << "Can't set DPMS for platform: " << getPlatformName();
} }
void
ResetScreensaver()
{
qDebug() << "Can't reset screensaver for: " << getPlatformName();
}
#endif #endif
} }

View file

@ -12,5 +12,7 @@ void
updateAppImage(); updateAppImage();
QString QString
createTimestamp(int seconds); createTimestamp(int seconds);
void
ResetScreensaver();
} }
#endif #endif