Advertisement
KukuRuzo

plugin change

Mar 24th, 2024
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. diff --git a/generic/videostatusplugin/videostatusplugin.cpp b/generic/videostatusplugin/videostatusplugin.cpp
  2. index b358aa9..24091a0 100644
  3. --- a/generic/videostatusplugin/videostatusplugin.cpp
  4. +++ b/generic/videostatusplugin/videostatusplugin.cpp
  5. @@ -199,6 +199,10 @@ void VideoStatusChanger::setPsiAccountControllingHost(PsiAccountControllingHost
  6.  
  7.  bool VideoStatusChanger::enable()
  8.  {
  9. +#ifdef HAVE_DBUS
  10. +    if(!X11Info::isPlatformX11())
  11. +        return false;
  12. +#endif
  13.      if (psiOptions) {
  14.          enabled = true;
  15.  #ifdef HAVE_DBUS
  16. diff --git a/generic/videostatusplugin/x11info.cpp b/generic/videostatusplugin/x11info.cpp
  17. index ed8ac1a..727878c 100644
  18. --- a/generic/videostatusplugin/x11info.cpp
  19. +++ b/generic/videostatusplugin/x11info.cpp
  20. @@ -19,6 +19,11 @@
  21.  #include "x11info.h"
  22.  
  23.  #include <QtGlobal>
  24. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  25. +#include <QX11Info>
  26. +#else
  27. +#include <QGuiApplication>
  28. +#endif
  29.  #include <X11/Xlib.h>
  30.  #include <xcb/xcb.h>
  31.  
  32. @@ -48,3 +53,13 @@ xcb_connection_t *X11Info::_xcb = nullptr;
  33.  
  34.  Display *X11Info::_display            = nullptr;
  35.  int      X11Info::_xcbPreferredScreen = 0;
  36. +
  37. +bool X11Info::isPlatformX11()
  38. +{
  39. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  40. +    return QX11Info::isPlatformX11();
  41. +#else
  42. +    auto x11app = qApp->nativeInterface<QNativeInterface::QX11Application>();
  43. +    return !!x11app;
  44. +#endif
  45. +}
  46. diff --git a/generic/videostatusplugin/x11info.h b/generic/videostatusplugin/x11info.h
  47. index 650de19..e463699 100644
  48. --- a/generic/videostatusplugin/x11info.h
  49. +++ b/generic/videostatusplugin/x11info.h
  50. @@ -32,6 +32,7 @@ public:
  51.      static unsigned long     appRootWindow(int screen = -1);
  52.      static xcb_connection_t *xcbConnection();
  53.      static inline int        xcbPreferredScreen() { return _xcbPreferredScreen; }
  54. +    static bool isPlatformX11();
  55.  };
  56.  
  57.  #endif // X11INFO_H
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement