From 23fb4651be69dea47a35f7bd296628dc00123203 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 13 Sep 2024 00:30:37 +0200 Subject: [PATCH] Remove remaining X11Extras stuff --- CMakeLists.txt | 24 ++++------ dist/unix/strawberry.spec.in | 3 -- src/CMakeLists.txt | 4 -- src/config.h.in | 4 +- src/globalshortcuts/globalshortcut-x11.cpp | 53 ---------------------- src/osd/osdpretty.cpp | 13 ++---- 6 files changed, 13 insertions(+), 88 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfc7a2e1d..f4913e141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,9 +182,6 @@ endif() if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND) get_target_property(QT_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert LOCATION) endif() -if(Qt${QT_VERSION_MAJOR}X11Extras_FOUND) - set(HAVE_X11EXTRAS ON) -endif() if(X11_FOUND) find_path(KEYSYMDEF_H NAMES "keysymdef.h" PATHS "${X11_INCLUDE_DIR}" PATH_SUFFIXES "X11") @@ -209,21 +206,19 @@ if(X11_FOUND) endif() # Check for QX11Application (Qt 6 compiled with XCB). - if(QT_VERSION_MAJOR EQUAL 6) - set(CMAKE_REQUIRED_FLAGS "-std=c++17") - set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) - check_cxx_source_compiles(" + set(CMAKE_REQUIRED_FLAGS "-std=c++17") + set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) + check_cxx_source_compiles(" #include int main() { (void)qApp->nativeInterface(); return 0; } " - HAVE_QX11APPLICATION - ) - unset(CMAKE_REQUIRED_FLAGS) - unset(CMAKE_REQUIRED_LIBRARIES) - endif() + HAVE_QX11APPLICATION + ) + unset(CMAKE_REQUIRED_FLAGS) + unset(CMAKE_REQUIRED_LIBRARIES) endif(X11_FOUND) @@ -352,12 +347,9 @@ optional_component(GLOBALSHORTCUTS ON "Global shortcuts" DEPENDS "D-Bus, X11, Windows or macOS" HAVE_GLOBALSHORTCUTS_SUPPORT ) -if(HAVE_QX11APPLICATION OR HAVE_X11EXTRAS OR HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) - set(X11_GLOBALSHORTCUTS_REQUIREMENT_FOUND ON) -endif() optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts" DEPENDS "X11" X11_FOUND - DEPENDS "QX11Application, X11Extras or qpa/qplatformnativeinterface.h header" X11_GLOBALSHORTCUTS_REQUIREMENT_FOUND + DEPENDS "QX11Application" HAVE_QX11APPLICATION ) optional_component(AUDIOCD ON "Devices: Audio CD support" diff --git a/dist/unix/strawberry.spec.in b/dist/unix/strawberry.spec.in index 9394134b1..b6c601068 100644 --- a/dist/unix/strawberry.spec.in +++ b/dist/unix/strawberry.spec.in @@ -55,9 +55,6 @@ BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Gui) BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Widgets) BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Test) BuildRequires: cmake(Qt@QT_VERSION_MAJOR@LinguistTools) -%if "@QT_VERSION_MAJOR@" == "5" -BuildRequires: cmake(Qt@QT_VERSION_MAJOR@X11Extras) -%endif BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-app-1.0) BuildRequires: pkgconfig(gstreamer-audio-1.0) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b405a5a5a..bad34bed0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1111,10 +1111,6 @@ if(HAVE_DBUS) target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::DBus) endif() -if(HAVE_X11_GLOBALSHORTCUTS AND HAVE_X11EXTRAS) - target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::X11Extras) -endif() - if(HAVE_ALSA) target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS}) target_link_directories(strawberry_lib PRIVATE ${ALSA_LIBRARY_DIRS}) diff --git a/src/config.h.in b/src/config.h.in index e309faea9..f74d6bf22 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -48,13 +48,11 @@ #cmakedefine INSTALL_TRANSLATIONS #define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/strawberry/translations" +#cmakedefine HAVE_QX11APPLICATION #cmakedefine HAVE_QPA_QPLATFORMNATIVEINTERFACE_H -#cmakedefine HAVE_X11EXTRAS #cmakedefine ENABLE_WIN32_CONSOLE -#cmakedefine HAVE_QX11APPLICATION - #cmakedefine HAVE_EBUR128 #endif // CONFIG_H_IN diff --git a/src/globalshortcuts/globalshortcut-x11.cpp b/src/globalshortcuts/globalshortcut-x11.cpp index 259a68d5c..6603d767e 100644 --- a/src/globalshortcuts/globalshortcut-x11.cpp +++ b/src/globalshortcuts/globalshortcut-x11.cpp @@ -35,22 +35,12 @@ #include #include -#ifndef HAVE_QX11APPLICATION -# if defined(HAVE_X11EXTRAS) -# include -# elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) -# include -# endif -#endif - const QVector GlobalShortcut::mask_modifiers_ = QVector() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); namespace { Display *X11Display() { -#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface. - if (!qApp) return nullptr; if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface()) { @@ -58,31 +48,10 @@ Display *X11Display() { } return nullptr; -#elif defined(HAVE_X11EXTRAS) // Qt 5: Use X11Extras - - return QX11Info::display(); - -#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) // Use private headers. - - if (!qApp) return nullptr; - - QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); - if (!native) return nullptr; - - return reinterpret_cast(native->nativeResourceForIntegration("display")); - -#else - -# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header." - -#endif - } quint32 AppRootWindow() { -#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface. - if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface()) { if (x11_app->display()) { return XDefaultRootWindow(x11_app->display()); @@ -90,28 +59,6 @@ quint32 AppRootWindow() { } return 0; -#elif defined(HAVE_X11EXTRAS) // Qt 5: Use X11Extras - - return QX11Info::appRootWindow(); - -#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) // Use private headers. - - if (!qApp) return 0; - - QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); - if (!native) return 0; - - QScreen *screen = QGuiApplication::primaryScreen(); - if (!screen) return 0; - - return static_cast(reinterpret_cast(native->nativeResourceForScreen("rootwindow", screen))); - -#else - -# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header." - -#endif - } } // namespace diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp index 96f63aa2d..9f64d0aab 100644 --- a/src/osd/osdpretty.cpp +++ b/src/osd/osdpretty.cpp @@ -51,14 +51,12 @@ #include #include -#include "core/settings.h" - -#ifdef HAVE_X11EXTRAS -# include -#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) +#ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE_H # include #endif +#include "core/settings.h" + #include "osdpretty.h" #include "ui_osdpretty.h" @@ -85,7 +83,6 @@ const int OSDPretty::kSnapProximity = 20; const QRgb OSDPretty::kPresetBlue = qRgb(102, 150, 227); const QRgb OSDPretty::kPresetRed = qRgb(202, 22, 16); - OSDPretty::OSDPretty(Mode mode, QWidget *parent) : QWidget(parent), ui_(new Ui_OSDPretty), @@ -219,9 +216,7 @@ void OSDPretty::ScreenRemoved(QScreen *screen) { bool OSDPretty::IsTransparencyAvailable() { -#ifdef HAVE_X11EXTRAS - return QX11Info::isCompositingManagerRunning(); -#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) +#ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE_H if (qApp) { QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;