Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/generic/videostatusplugin/videostatusplugin.cpp b/generic/videostatusplugin/videostatusplugin.cpp
- index b358aa9..24091a0 100644
- --- a/generic/videostatusplugin/videostatusplugin.cpp
- +++ b/generic/videostatusplugin/videostatusplugin.cpp
- @@ -199,6 +199,10 @@ void VideoStatusChanger::setPsiAccountControllingHost(PsiAccountControllingHost
- bool VideoStatusChanger::enable()
- {
- +#ifdef HAVE_DBUS
- + if(!X11Info::isPlatformX11())
- + return false;
- +#endif
- if (psiOptions) {
- enabled = true;
- #ifdef HAVE_DBUS
- diff --git a/generic/videostatusplugin/x11info.cpp b/generic/videostatusplugin/x11info.cpp
- index ed8ac1a..727878c 100644
- --- a/generic/videostatusplugin/x11info.cpp
- +++ b/generic/videostatusplugin/x11info.cpp
- @@ -19,6 +19,11 @@
- #include "x11info.h"
- #include <QtGlobal>
- +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- +#include <QX11Info>
- +#else
- +#include <QGuiApplication>
- +#endif
- #include <X11/Xlib.h>
- #include <xcb/xcb.h>
- @@ -48,3 +53,13 @@ xcb_connection_t *X11Info::_xcb = nullptr;
- Display *X11Info::_display = nullptr;
- int X11Info::_xcbPreferredScreen = 0;
- +
- +bool X11Info::isPlatformX11()
- +{
- +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- + return QX11Info::isPlatformX11();
- +#else
- + auto x11app = qApp->nativeInterface<QNativeInterface::QX11Application>();
- + return !!x11app;
- +#endif
- +}
- diff --git a/generic/videostatusplugin/x11info.h b/generic/videostatusplugin/x11info.h
- index 650de19..e463699 100644
- --- a/generic/videostatusplugin/x11info.h
- +++ b/generic/videostatusplugin/x11info.h
- @@ -32,6 +32,7 @@ public:
- static unsigned long appRootWindow(int screen = -1);
- static xcb_connection_t *xcbConnection();
- static inline int xcbPreferredScreen() { return _xcbPreferredScreen; }
- + static bool isPlatformX11();
- };
- #endif // X11INFO_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement