Remove use of X11Extras and WinExtras

Modules are deprecated in Qt 6
See: QTBUG-83251
This commit is contained in:
jonas@jkvinge.net 2021-05-12 20:08:06 +02:00
parent a01541d7ca
commit efcd35d4a1
14 changed files with 160 additions and 97 deletions

View File

@ -42,13 +42,13 @@ jobs:
taglib-devel
libQt5Core-devel
libQt5Gui-devel
libQt5Gui-private-headers-devel
libQt5Widgets-devel
libQt5Concurrent-devel
libQt5Network-devel
libQt5Sql-devel
libQt5DBus-devel
libQt5Test-devel
libqt5-qtx11extras-devel
libqt5-qtbase-common-devel
libQt5Sql5-sqlite
libqt5-linguist-devel
@ -111,13 +111,13 @@ jobs:
taglib-devel
libQt5Core-devel
libQt5Gui-devel
libQt5Gui-private-headers-devel
libQt5Widgets-devel
libQt5Concurrent-devel
libQt5Network-devel
libQt5Sql-devel
libQt5DBus-devel
libQt5Test-devel
libqt5-qtx11extras-devel
libqt5-qtbase-common-devel
libQt5Sql5-sqlite
libqt5-linguist-devel
@ -190,6 +190,7 @@ jobs:
taglib-devel
qt6-core-devel
qt6-gui-devel
qt6-gui-private-devel
qt6-widgets-devel
qt6-concurrent-devel
qt6-network-devel
@ -266,13 +267,13 @@ jobs:
taglib-devel
libQt5Core-devel
libQt5Gui-devel
libQt5Gui-private-headers-devel
libQt5Widgets-devel
libQt5Concurrent-devel
libQt5Network-devel
libQt5Sql-devel
libQt5DBus-devel
libQt5Test-devel
libqt5-qtx11extras-devel
libqt5-qtbase-common-devel
libQt5Sql5-sqlite
libqt5-linguist-devel
@ -345,6 +346,7 @@ jobs:
taglib-devel
qt6-core-devel
qt6-gui-devel
qt6-gui-private-devel
qt6-widgets-devel
qt6-concurrent-devel
qt6-network-devel
@ -423,13 +425,13 @@ jobs:
taglib-devel
libQt5Core-devel
libQt5Gui-devel
libQt5Gui-private-headers-devel
libQt5Widgets-devel
libQt5Concurrent-devel
libQt5Network-devel
libQt5Sql-devel
libQt5DBus-devel
libQt5Test-devel
libqt5-qtx11extras-devel
libqt5-qtbase-common-devel
libQt5Sql5-sqlite
libqt5-linguist-devel
@ -502,6 +504,7 @@ jobs:
taglib-devel
qt6-core-devel
qt6-gui-devel
qt6-gui-private-devel
qt6-widgets-devel
qt6-concurrent-devel
qt6-network-devel
@ -583,7 +586,7 @@ jobs:
gnutls-devel
qt5-devel
qt5-qtbase-devel
qt5-qtx11extras-devel
qt5-qtbase-private-devel
qt5-qttools-devel
gstreamer1-devel
gstreamer1-plugins-base-devel
@ -660,7 +663,7 @@ jobs:
libnotify-devel
gnutls-devel
qt5-qtbase-devel
qt5-qtx11extras-devel
qt5-qtbase-private-devel
qt5-qttools-devel
gstreamer1-devel
gstreamer1-plugins-base-devel
@ -737,7 +740,7 @@ jobs:
libnotify-devel
gnutls-devel
qt5-qtbase-devel
qt5-qtx11extras-devel
qt5-qtbase-private-devel
qt5-qttools-devel
gstreamer1-devel
gstreamer1-plugins-base-devel
@ -825,7 +828,7 @@ jobs:
alsa-lib-devel
pulseaudio-libs-devel
qt5-qtbase-devel
qt5-qtx11extras-devel
qt5-qtbase-private-devel
qt5-qttools-devel
fftw-devel
libchromaprint-devel
@ -901,7 +904,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
@ -959,7 +961,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
@ -1021,7 +1022,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
@ -1084,7 +1084,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
@ -1147,7 +1146,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
@ -1210,7 +1208,6 @@ jobs:
qtbase5-dev
qtbase5-dev-tools
qtbase5-private-dev
libqt5x11extras5-dev
qttools5-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev

View File

@ -169,12 +169,6 @@ endif()
if(DBUS_FOUND AND NOT WIN32)
list(APPEND QT_COMPONENTS DBus)
endif()
if(X11_FOUND)
list(APPEND QT_OPTIONAL_COMPONENTS X11Extras)
endif()
if(WIN32)
list(APPEND QT_OPTIONAL_COMPONENTS WinExtras)
endif()
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS ${QT_COMPONENTS} OPTIONAL_COMPONENTS ${QT_OPTIONAL_COMPONENTS})
@ -190,16 +184,6 @@ if(Qt${QT_MAJOR_VERSION}DBus_FOUND)
list(APPEND QT_LIBRARIES Qt${QT_MAJOR_VERSION}::DBus)
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt${QT_MAJOR_VERSION}::qdbusxml2cpp LOCATION)
endif()
if(Qt${QT_MAJOR_VERSION}X11Extras_FOUND)
set(QtX11Extras_LIBRARIES Qt${QT_MAJOR_VERSION}::X11Extras)
list(APPEND QT_LIBRARIES Qt${QT_MAJOR_VERSION}::X11Extras)
set(HAVE_X11EXTRAS ON)
endif()
if(Qt${QT_MAJOR_VERSION}WinExtras_FOUND)
set(QtWinExtras_LIBRARIES Qt${QT_MAJOR_VERSION}::WinExtras)
list(APPEND QT_LIBRARIES Qt${QT_MAJOR_VERSION}::WinExtras)
set(HAVE_WINEXTRAS ON)
endif()
if(Qt${QT_MAJOR_VERSION}Test_FOUND)
set(QtTest_LIBRARIES Qt${QT_MAJOR_VERSION}::Test)
endif()
@ -320,7 +304,8 @@ optional_component(GLOBALSHORTCUTS ON "Global shortcuts"
)
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
DEPENDS "X11Extras" Qt${QT_MAJOR_VERSION}X11Extras_FOUND
DEPENDS "X11" X11_FOUND
DEPENDS "qpa/qplatformnativeinterface.h" HAVE_QPA_QPLATFORMNATIVEINTERFACE_H
)
optional_component(AUDIOCD ON "Devices: Audio CD support"
@ -419,7 +404,7 @@ add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_CAST_TO_ASCII)
if(WIN32 AND QT_MAJOR_VERSION EQUAL 5)
if(WIN32)
add_definitions(-DUNICODE)
endif()

View File

@ -71,7 +71,6 @@ To build Strawberry from source you need the following installed on your system
* [GLib](https://developer.gnome.org/glib/)
* [Protobuf](https://developers.google.com/protocol-buffers/)
* [Qt 5.8 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
* [Qt components X11Extras and D-Bus for Linux/BSD and WinExtras for Windows](https://www.qt.io/)
* [SQLite 3.9 or newer with FTS5](https://www.sqlite.org)
* [Chromaprint](https://acoustid.org/chromaprint)
* [ALSA (linux)](https://www.alsa-project.org/)

2
debian/control vendored
View File

@ -17,9 +17,9 @@ Build-Depends: debhelper (>= 11),
libpulse-dev,
libtag1-dev,
qtbase5-dev,
qtbase5-private-dev,
qtbase5-dev-tools,
qttools5-dev,
libqt5x11extras5-dev,
libgstreamer1.0-dev,
libgstreamer-plugins-base1.0-dev,
libcdio-dev,

View File

@ -56,7 +56,6 @@ BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@Widgets)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@Concurrent)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@Network)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@Sql)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@X11Extras)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@DBus)
BuildRequires: pkgconfig(Qt@QT_MAJOR_VERSION@Test)
%else

View File

@ -283,7 +283,6 @@ Section "Strawberry" Strawberry
File "Qt6Network.dll"
File "Qt6Sql.dll"
File "Qt6Widgets.dll"
File "Qt6WinExtras.dll"
File "libqtsparkle-qt6.dll"
!else
File "Qt5Concurrent.dll"
@ -292,7 +291,6 @@ Section "Strawberry" Strawberry
File "Qt5Network.dll"
File "Qt5Sql.dll"
File "Qt5Widgets.dll"
File "Qt5WinExtras.dll"
File "libqtsparkle-qt5.dll"
!endif
@ -545,14 +543,12 @@ Section "Uninstall"
Delete "$INSTDIR\Qt5Network.dll"
Delete "$INSTDIR\Qt5Sql.dll"
Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\Qt5WinExtras.dll"
Delete "$INSTDIR\Qt6Concurrent.dll"
Delete "$INSTDIR\Qt6Core.dll"
Delete "$INSTDIR\Qt6Gui.dll"
Delete "$INSTDIR\Qt6Network.dll"
Delete "$INSTDIR\Qt6Sql.dll"
Delete "$INSTDIR\Qt6Widgets.dll"
Delete "$INSTDIR\Qt6WinExtras.dll"
Delete "$INSTDIR\swresample-3.dll"
Delete "$INSTDIR\swscale-5.dll"
Delete "$INSTDIR\zlib1.dll"

View File

@ -551,23 +551,24 @@ if(HAVE_GLOBALSHORTCUTS)
HEADERS globalshortcuts/globalshortcutsmanager.h globalshortcuts/globalshortcutsbackend.h globalshortcuts/globalshortcutgrabber.h settings/globalshortcutssettingspage.h
UI globalshortcuts/globalshortcutgrabber.ui settings/globalshortcutssettingspage.ui
)
if(HAVE_X11EXTRAS OR WIN32)
set(X11_OR_WIN ON)
endif()
optional_source(X11_OR_WIN
SOURCES globalshortcuts/globalshortcutsbackend-system.cpp globalshortcuts/globalshortcut.cpp
HEADERS globalshortcuts/globalshortcutsbackend-system.h globalshortcuts/globalshortcut.h
)
optional_source(HAVE_X11EXTRAS
SOURCES globalshortcuts/globalshortcut-x11.cpp
)
optional_source(HAVE_DBUS
SOURCES globalshortcuts/globalshortcutsbackend-gsd.cpp globalshortcuts/globalshortcutsbackend-kde.cpp
HEADERS globalshortcuts/globalshortcutsbackend-gsd.h globalshortcuts/globalshortcutsbackend-kde.h
)
optional_source(WIN32
SOURCES globalshortcuts/globalshortcut-win.cpp
)
# Native shortcuts for X11 and Windows
if(HAVE_X11_GLOBALSHORTCUTS OR WIN32)
SET(X11_OR_WIN ON)
optional_source(X11_OR_WIN
SOURCES globalshortcuts/globalshortcutsbackend-system.cpp globalshortcuts/globalshortcut.cpp
HEADERS globalshortcuts/globalshortcutsbackend-system.h globalshortcuts/globalshortcut.h
)
optional_source(HAVE_X11_GLOBALSHORTCUTS
SOURCES globalshortcuts/globalshortcut-x11.cpp
)
optional_source(WIN32
SOURCES globalshortcuts/globalshortcut-win.cpp
)
endif()
endif(HAVE_GLOBALSHORTCUTS)
# ALSA
@ -1250,7 +1251,7 @@ if(APPLE)
endif(APPLE)
if(WIN32)
target_link_libraries(strawberry_lib PRIVATE dsound)
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi)
endif(WIN32)
if(X11_FOUND)
@ -1305,4 +1306,4 @@ endif()
if(APPLE)
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist")
endif (APPLE)
endif(APPLE)

View File

@ -43,8 +43,6 @@
#cmakedefine INSTALL_TRANSLATIONS
#define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/strawberry/translations"
#cmakedefine HAVE_X11EXTRAS
#cmakedefine HAVE_WINEXTRAS
#cmakedefine HAVE_QPA_QPLATFORMNATIVEINTERFACE_H
#cmakedefine ENABLE_WIN32_CONSOLE

View File

@ -28,6 +28,7 @@
#include <QtGlobal>
#include <QApplication>
#include <QCoreApplication>
#include <QWindow>
#include <QWidget>
#include <QObject>
#include <QIODevice>
@ -51,6 +52,7 @@
#include <QRegularExpressionMatch>
#include <QSize>
#include <QColor>
#include <QRegion>
#include <QMetaEnum>
#include <QXmlStreamReader>
#include <QSettings>
@ -79,6 +81,7 @@
# include <sys/statvfs.h>
#elif defined(Q_OS_WIN)
# include <windows.h>
# include <dwmapi.h>
#endif
#ifdef Q_OS_MACOS
@ -952,6 +955,62 @@ QString MimeTypeFromData(const QByteArray &data) {
}
#ifdef Q_OS_WIN
HRGN qt_RectToHRGN(const QRect &rc);
HRGN qt_RectToHRGN(const QRect &rc) {
return CreateRectRgn(rc.left(), rc.top(), rc.right() + 1, rc.bottom() + 1);
}
HRGN toHRGN(const QRegion &region);
HRGN toHRGN(const QRegion &region) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return region.toHRGN();
#else
const int rect_count = region.rectCount();
if (rect_count == 0) {
return nullptr;
}
HRGN resultRgn = nullptr;
QRegion::const_iterator rects = region.begin();
resultRgn = qt_RectToHRGN(rects[0]);
for (int i = 1 ; i < rect_count ; ++i) {
HRGN tmpRgn = qt_RectToHRGN(rects[i]);
const int res = CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR);
if (res == ERROR) qWarning("Error combining HRGNs.");
DeleteObject(tmpRgn);
}
return resultRgn;
#endif // Qt 6
}
void enableBlurBehindWindow(QWindow *window, const QRegion &region) {
DWM_BLURBEHIND dwmbb = {0, 0, nullptr, 0};
dwmbb.dwFlags = DWM_BB_ENABLE;
dwmbb.fEnable = TRUE;
HRGN rgn = nullptr;
if (!region.isNull()) {
rgn = toHRGN(region);
if (rgn) {
dwmbb.hRgnBlur = rgn;
dwmbb.dwFlags |= DWM_BB_BLURREGION;
}
}
DwmEnableBlurBehindWindow(reinterpret_cast<HWND>(window->winId()), &dwmbb);
if (rgn) {
DeleteObject(rgn);
}
}
#endif // Q_OS_WIN
} // namespace Utilities
ScopedWCharArray::ScopedWCharArray(const QString &str)

View File

@ -27,6 +27,7 @@
#include <memory>
#include <QtGlobal>
#include <QWindow>
#include <QByteArray>
#include <QFile>
#include <QSize>
@ -38,6 +39,7 @@
#include <QStringList>
#include <QUrl>
#include <QColor>
#include <QRegion>
#include <QtEvents>
#include "core/song.h"
@ -146,6 +148,10 @@ bool IsColorDark(const QColor &color);
QByteArray ReadDataFromFile(const QString &filename);
QString MimeTypeFromData(const QByteArray &data);
#ifdef Q_OS_WIN
void enableBlurBehindWindow(QWindow *window, const QRegion &region);
#endif
} // namespace
class ScopedWCharArray {

View File

@ -54,7 +54,6 @@ bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods)
return UnregisterHotKey(0, native_mods ^ native_key);
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) {
#else

View File

@ -20,13 +20,14 @@
#include "config.h"
#include <QtGlobal>
#include <QApplication>
#include <QMap>
#include <QVector>
#include <QByteArray>
#include <QString>
#include <QX11Info>
#include <QKeySequence>
#include <QFlags>
#include <QScreen>
#include "globalshortcut.h"
#include "keymapper_x11.h"
@ -36,8 +37,40 @@
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <qpa/qplatformnativeinterface.h>
const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask);
namespace {
Display *X11Display() {
if (!qApp) return nullptr;
QPlatformNativeInterface *native = qApp->platformNativeInterface();
if (!native) return nullptr;
void *display = native->nativeResourceForIntegration("display");
return reinterpret_cast<Display*>(display);
}
quint32 AppRootWindow() {
if (!qApp) return 0;
QPlatformNativeInterface *native = qApp->platformNativeInterface();
if (!native) return 0;
QScreen *screen = QGuiApplication::primaryScreen();
if (!screen) return 0;
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("rootwindow", screen)));
}
}
quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
quint32 native_mods = 0;
@ -51,7 +84,8 @@ quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
if (!QX11Info::display()) return 0;
Display *disp = X11Display();
if (!disp) return false;
quint32 keysym = 0;
if (KeyMapperX11::keymapper_x11_.contains(qt_key)) {
@ -61,25 +95,32 @@ quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
keysym = XStringToKeysym(QKeySequence(qt_key).toString().toLatin1().data());
if (keysym == NoSymbol) return 0;
}
return XKeysymToKeycode(QX11Info::display(), keysym);
return XKeysymToKeycode(disp, keysym);
}
bool GlobalShortcut::registerShortcut(quint32 native_key, quint32 native_mods) {
if (!QX11Info::display()) return false;
Display *disp = X11Display();
if (!disp) return false;
for (quint32 mask_mods : mask_modifiers_) {
//xcb_grab_key(QX11Info::connection(), 1, QX11Info::appRootWindow(), (native_mods | mask_mods), native_key, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
XGrabKey(QX11Info::display(), native_key, (native_mods | mask_mods), QX11Info::appRootWindow(), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, native_key, (native_mods | mask_mods), AppRootWindow(), True, GrabModeAsync, GrabModeAsync);
}
return true;
}
bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods) {
if (!QX11Info::display()) return false;
Display *disp = X11Display();
if (!disp) return false;
for (quint32 mask_mods : mask_modifiers_) {
XUngrabKey(QX11Info::display(), native_key, native_mods | mask_mods, QX11Info::appRootWindow());
XUngrabKey(disp, native_key, native_mods | mask_mods, AppRootWindow());
}
return true;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@ -23,6 +23,7 @@
#include <functional>
#include <QApplication>
#include <QWidget>
#include <QVariant>
#include <QString>
@ -32,9 +33,6 @@
#ifdef HAVE_DBUS
# include <QDBusConnectionInterface>
#endif
#ifdef HAVE_X11EXTRAS
# include <QX11Info>
#endif
#include "globalshortcutsmanager.h"
#include "globalshortcutsbackend.h"
@ -43,7 +41,7 @@
# include "globalshortcutsbackend-gsd.h"
# include "globalshortcutsbackend-kde.h"
#endif
#if defined(HAVE_X11EXTRAS) || defined(Q_OS_WIN)
#if (defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)) || defined(Q_OS_WIN)
# include "globalshortcutsbackend-system.h"
#endif
#ifdef Q_OS_MACOS
@ -99,7 +97,7 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent)
if (!system_backend_)
system_backend_ = new GlobalShortcutsBackendSystem(this);
#endif
#if defined(HAVE_X11EXTRAS)
#if defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
if (!system_backend_ && IsX11Available())
system_backend_ = new GlobalShortcutsBackendSystem(this);
#endif
@ -168,11 +166,7 @@ bool GlobalShortcutsManager::IsKdeAvailable() const {
bool GlobalShortcutsManager::IsX11Available() const {
#ifdef HAVE_X11EXTRAS
return QX11Info::isPlatformX11();
#else
return false;
#endif
return QApplication::platformName() == "xcb";
}
@ -180,12 +174,12 @@ void GlobalShortcutsManager::Register() {
if (use_gsd_ && gsd_backend_ && gsd_backend_->Register()) return;
if (use_kde_ && kde_backend_ && kde_backend_->Register()) return;
#ifdef HAVE_X11EXTRAS // If this system has X11, only use the system backend if X11 is enabled in the global shortcut settings
#if defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) // If this system has X11, only use the system backend if X11 is enabled in the global shortcut settings
if (use_x11_) {
#endif
if (system_backend_)
system_backend_->Register();
#ifdef HAVE_X11EXTRAS
#if defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
}
#endif

View File

@ -53,14 +53,9 @@
#include <QSettings>
#include <QFlags>
#include <QtEvents>
#ifdef HAVE_X11EXTRAS
# include <QX11Info>
#elif defined(Q_OS_UNIX) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
#if defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
# include <qpa/qplatformnativeinterface.h>
#endif
#ifdef HAVE_WINEXTRAS
# include <QtWin>
#endif
#include "osdpretty.h"
#include "ui_osdpretty.h"
@ -69,6 +64,8 @@
# include <windows.h>
#endif
#include "core/utilities.h"
const char *OSDPretty::kSettingsGroup = "OSDPretty";
const int OSDPretty::kDropShadowSize = 13;
@ -213,21 +210,14 @@ void OSDPretty::ScreenRemoved(QScreen *screen) {
bool OSDPretty::IsTransparencyAvailable() {
#if defined(HAVE_X11EXTRAS)
return QX11Info::isCompositingManagerRunning();
#elif defined(Q_OS_UNIX) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
#if defined(HAVE_X11) && 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;
QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;
if (native && screen) {
return native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen);
}
else return false;
}
else return false;
#endif
return true;
@ -452,9 +442,9 @@ void OSDPretty::Reposition() {
setMask(mask);
}
#ifdef HAVE_WINEXTRAS
// On windows, enable blurbehind on the masked area
QtWin::enableBlurBehindWindow(this, QRegion(mask));
#ifdef Q_OS_WIN
Utilities::enableBlurBehindWindow(this->windowHandle(), QRegion(mask));
#endif
}
@ -607,4 +597,3 @@ void OSDPretty::set_font(QFont font) {
Reposition();
}