Remove remaining X11Extras stuff

This commit is contained in:
Jonas Kvinge 2024-09-13 00:30:37 +02:00
parent 877c9ca41a
commit 23fb4651be
6 changed files with 13 additions and 88 deletions

View File

@ -182,9 +182,6 @@ endif()
if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND) if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
get_target_property(QT_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert LOCATION) get_target_property(QT_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert LOCATION)
endif() endif()
if(Qt${QT_VERSION_MAJOR}X11Extras_FOUND)
set(HAVE_X11EXTRAS ON)
endif()
if(X11_FOUND) if(X11_FOUND)
find_path(KEYSYMDEF_H NAMES "keysymdef.h" PATHS "${X11_INCLUDE_DIR}" PATH_SUFFIXES "X11") find_path(KEYSYMDEF_H NAMES "keysymdef.h" PATHS "${X11_INCLUDE_DIR}" PATH_SUFFIXES "X11")
@ -209,21 +206,19 @@ if(X11_FOUND)
endif() endif()
# Check for QX11Application (Qt 6 compiled with XCB). # Check for QX11Application (Qt 6 compiled with XCB).
if(QT_VERSION_MAJOR EQUAL 6) set(CMAKE_REQUIRED_FLAGS "-std=c++17")
set(CMAKE_REQUIRED_FLAGS "-std=c++17") set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui)
set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) check_cxx_source_compiles("
check_cxx_source_compiles("
#include <QGuiApplication> #include <QGuiApplication>
int main() { int main() {
(void)qApp->nativeInterface<QNativeInterface::QX11Application>(); (void)qApp->nativeInterface<QNativeInterface::QX11Application>();
return 0; return 0;
} }
" "
HAVE_QX11APPLICATION HAVE_QX11APPLICATION
) )
unset(CMAKE_REQUIRED_FLAGS) unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_LIBRARIES) unset(CMAKE_REQUIRED_LIBRARIES)
endif()
endif(X11_FOUND) endif(X11_FOUND)
@ -352,12 +347,9 @@ optional_component(GLOBALSHORTCUTS ON "Global shortcuts"
DEPENDS "D-Bus, X11, Windows or macOS" HAVE_GLOBALSHORTCUTS_SUPPORT 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" optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
DEPENDS "X11" X11_FOUND 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" optional_component(AUDIOCD ON "Devices: Audio CD support"

View File

@ -55,9 +55,6 @@ BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Gui)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Widgets) BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Widgets)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Test) BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Test)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@LinguistTools) 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-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0) BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-audio-1.0) BuildRequires: pkgconfig(gstreamer-audio-1.0)

View File

@ -1111,10 +1111,6 @@ if(HAVE_DBUS)
target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::DBus) target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::DBus)
endif() endif()
if(HAVE_X11_GLOBALSHORTCUTS AND HAVE_X11EXTRAS)
target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::X11Extras)
endif()
if(HAVE_ALSA) if(HAVE_ALSA)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
target_link_directories(strawberry_lib PRIVATE ${ALSA_LIBRARY_DIRS}) target_link_directories(strawberry_lib PRIVATE ${ALSA_LIBRARY_DIRS})

View File

@ -48,13 +48,11 @@
#cmakedefine INSTALL_TRANSLATIONS #cmakedefine INSTALL_TRANSLATIONS
#define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/strawberry/translations" #define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/strawberry/translations"
#cmakedefine HAVE_QX11APPLICATION
#cmakedefine HAVE_QPA_QPLATFORMNATIVEINTERFACE_H #cmakedefine HAVE_QPA_QPLATFORMNATIVEINTERFACE_H
#cmakedefine HAVE_X11EXTRAS
#cmakedefine ENABLE_WIN32_CONSOLE #cmakedefine ENABLE_WIN32_CONSOLE
#cmakedefine HAVE_QX11APPLICATION
#cmakedefine HAVE_EBUR128 #cmakedefine HAVE_EBUR128
#endif // CONFIG_H_IN #endif // CONFIG_H_IN

View File

@ -35,22 +35,12 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xproto.h> #include <xcb/xproto.h>
#ifndef HAVE_QX11APPLICATION
# if defined(HAVE_X11EXTRAS)
# include <QX11Info>
# elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
# include <qpa/qplatformnativeinterface.h>
# endif
#endif
const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); const QVector<quint32> GlobalShortcut::mask_modifiers_ = QVector<quint32>() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask);
namespace { namespace {
Display *X11Display() { Display *X11Display() {
#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface.
if (!qApp) return nullptr; if (!qApp) return nullptr;
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) { if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
@ -58,31 +48,10 @@ Display *X11Display() {
} }
return nullptr; 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<Display*>(native->nativeResourceForIntegration("display"));
#else
# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header."
#endif
} }
quint32 AppRootWindow() { quint32 AppRootWindow() {
#ifdef HAVE_QX11APPLICATION // Qt 6.2: Use the new native interface.
if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) { if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface<QNativeInterface::QX11Application>()) {
if (x11_app->display()) { if (x11_app->display()) {
return XDefaultRootWindow(x11_app->display()); return XDefaultRootWindow(x11_app->display());
@ -90,28 +59,6 @@ quint32 AppRootWindow() {
} }
return 0; 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<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("rootwindow", screen)));
#else
# error "Missing QX11Application, X11Extras or qpa/qplatformnativeinterface.h header."
#endif
} }
} // namespace } // namespace

View File

@ -51,14 +51,12 @@
#include <QFlags> #include <QFlags>
#include <QtEvents> #include <QtEvents>
#include "core/settings.h" #ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE_H
#ifdef HAVE_X11EXTRAS
# include <QX11Info>
#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
# include <qpa/qplatformnativeinterface.h> # include <qpa/qplatformnativeinterface.h>
#endif #endif
#include "core/settings.h"
#include "osdpretty.h" #include "osdpretty.h"
#include "ui_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::kPresetBlue = qRgb(102, 150, 227);
const QRgb OSDPretty::kPresetRed = qRgb(202, 22, 16); const QRgb OSDPretty::kPresetRed = qRgb(202, 22, 16);
OSDPretty::OSDPretty(Mode mode, QWidget *parent) OSDPretty::OSDPretty(Mode mode, QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui_(new Ui_OSDPretty), ui_(new Ui_OSDPretty),
@ -219,9 +216,7 @@ void OSDPretty::ScreenRemoved(QScreen *screen) {
bool OSDPretty::IsTransparencyAvailable() { bool OSDPretty::IsTransparencyAvailable() {
#ifdef HAVE_X11EXTRAS #ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE_H
return QX11Info::isCompositingManagerRunning();
#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
if (qApp) { if (qApp) {
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_; QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;