Make X11Extras and WinExtras optional

The initial release of Qt 6 does not have these.

These modules are not important.
X11Extras is only used for X11 global shortcuts, which in most cases is
overriden by KDE or Gnome shortcuts anyway.
It is also used in OSD Pretty to detect transparency, but this can be
done using private GUI headers instead.

WinExtras is only used in OSD Pretty to make it transparent.
This commit is contained in:
Jonas Kvinge
2020-11-29 07:41:30 +01:00
parent 0808db706f
commit fc02543f15
7 changed files with 59 additions and 19 deletions

View File

@@ -53,10 +53,12 @@
#include <QSettings>
#include <QFlags>
#include <QtEvents>
#ifdef HAVE_X11
#ifdef HAVE_X11EXTRAS
# include <QX11Info>
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
# include <qpa/qplatformnativeinterface.h>
#endif
#ifdef Q_OS_WIN
#ifdef HAVE_WINEXTRAS
# include <QtWin>
#endif
@@ -214,10 +216,26 @@ void OSDPretty::ScreenRemoved(QScreen *screen) {
}
bool OSDPretty::IsTransparencyAvailable() {
#if defined(HAVE_X11)
#if defined(HAVE_X11EXTRAS)
return QX11Info::isCompositingManagerRunning();
#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
if (qApp) {
QPlatformNativeInterface *native = qApp->platformNativeInterface();
if (native) {
QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;
if (screen) {
return native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen);
}
else return false;
}
else return false;
}
else return false;
#endif
return true;
}
void OSDPretty::Load() {
@@ -433,10 +451,11 @@ void OSDPretty::Reposition() {
setMask(mask);
}
#ifdef Q_OS_WIN
#ifdef HAVE_WINEXTRAS
// On windows, enable blurbehind on the masked area
QtWin::enableBlurBehindWindow(this, QRegion(mask));
#endif
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)