fixed compile on Linux with Qt5 (patch from sehraf)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8116 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-04-04 10:12:05 +00:00
parent ee68d00376
commit a37ab6f644
2 changed files with 11 additions and 0 deletions

View File

@ -73,7 +73,11 @@ bool IdlePlatform::init()
old_handler = XSetErrorHandler(xerrhandler); old_handler = XSetErrorHandler(xerrhandler);
int event_base, error_base; int event_base, error_base;
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
if(XScreenSaverQueryExtension(QX11Info::display(), &event_base, &error_base)) {
#else
if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Info().display(), &event_base, &error_base)) { if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Info().display(), &event_base, &error_base)) {
#endif
d->ss_info = XScreenSaverAllocInfo(); d->ss_info = XScreenSaverAllocInfo();
return true; return true;
} }
@ -84,7 +88,11 @@ int IdlePlatform::secondsIdle()
{ {
if(!d->ss_info) if(!d->ss_info)
return 0; return 0;
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
if(!XScreenSaverQueryInfo(QX11Info::display(), QX11Info::appRootWindow(), d->ss_info))
#else
if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Info().display(), QX11Info::appRootWindow(), d->ss_info)) if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Info().display(), QX11Info::appRootWindow(), d->ss_info))
#endif
return 0; return 0;
return d->ss_info->idle / 1000; return d->ss_info->idle / 1000;
} }

View File

@ -13,6 +13,9 @@ CONFIG += qt gui uic qrc resources idle bitdht
greaterThan(QT_MAJOR_VERSION, 4) { greaterThan(QT_MAJOR_VERSION, 4) {
# Qt 5 # Qt 5
QT += uitools widgets multimedia printsupport QT += uitools widgets multimedia printsupport
linux-* {
QT += x11extras
}
} else { } else {
# Qt 4 # Qt 4
CONFIG += uitools CONFIG += uitools