From 26088a7cbba39a4c87a42fc1e0fc75fb8a07096f Mon Sep 17 00:00:00 2001 From: Christoph Johannes Kleine Date: Sun, 20 Jul 2025 20:48:07 +0200 Subject: [PATCH] Replaced depracted QX11Info by QGuiApplication --- retroshare-gui/src/idle/idle_platform.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/idle/idle_platform.cpp b/retroshare-gui/src/idle/idle_platform.cpp index 71928dc59..c3d582acc 100644 --- a/retroshare-gui/src/idle/idle_platform.cpp +++ b/retroshare-gui/src/idle/idle_platform.cpp @@ -24,10 +24,15 @@ #ifdef HAVE_XSS #include +#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0) +#include +#else +#include +#endif + #if QT_VERSION < QT_VERSION_CHECK(5,0,0) #include #endif -#include #include #include @@ -75,7 +80,10 @@ bool IdlePlatform::init() old_handler = XSetErrorHandler(xerrhandler); int event_base, error_base; -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0) + QNativeInterface::QX11Application *nativeInterface = qGuiApp->nativeInterface(); + if (nativeInterface && XScreenSaverQueryExtension(nativeInterface->display(), &event_base, &error_base)) { +#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0) if(QX11Info::isPlatformX11() && XScreenSaverQueryExtension(QX11Info::display(), &event_base, &error_base)) { #else if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Info().display(), &event_base, &error_base)) { @@ -90,7 +98,10 @@ int IdlePlatform::secondsIdle() { if(!d->ss_info) return 0; -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0) + QNativeInterface::QX11Application *nativeInterface = qGuiApp->nativeInterface(); + if(!nativeInterface || !XScreenSaverQueryInfo(nativeInterface->display(), DefaultRootWindow(nativeInterface->display()), d->ss_info)) +#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0) if(!QX11Info::isPlatformX11() || !XScreenSaverQueryInfo(QX11Info::display(), QX11Info::appRootWindow(), d->ss_info)) #else if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Info().display(), QX11Info::appRootWindow(), d->ss_info))