From 87b121069f9027a014b499e01b71ddd3180d4f94 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 20 Oct 2021 14:54:48 +0400 Subject: [PATCH] Add checks for libraries not ported to Qt 6 yet --- CMakeLists.txt | 8 +++++++- ui/platform/linux/ui_linux_wayland_integration.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e88ffd..f6769ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,8 +259,14 @@ elseif(LINUX) target_link_libraries(lib_ui PUBLIC desktop-app::lib_waylandshells - desktop-app::external_kwayland ) + + if (NOT DESKTOP_APP_QT6) + target_link_libraries(lib_ui + PUBLIC + desktop-app::external_kwayland + ) + endif() endif() target_include_directories(lib_ui diff --git a/ui/platform/linux/ui_linux_wayland_integration.cpp b/ui/platform/linux/ui_linux_wayland_integration.cpp index 01f1e80..850494b 100644 --- a/ui/platform/linux/ui_linux_wayland_integration.cpp +++ b/ui/platform/linux/ui_linux_wayland_integration.cpp @@ -24,27 +24,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include #include +#endif // Qt < 6.0.0 Q_DECLARE_METATYPE(QMargins); using QtWaylandClient::QWaylandIntegration; using QtWaylandClient::QWaylandWindow; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) using namespace KWayland::Client; +#endif // Qt < 6.0.0 namespace Ui { namespace Platform { struct WaylandIntegration::Private { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) std::unique_ptr connection; Registry registry; QEventLoop interfacesLoop; bool interfacesAnnounced = false; +#endif // Qt < 6.0.0 }; WaylandIntegration::WaylandIntegration() : _private(std::make_unique()) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) _private->connection = std::unique_ptr{ ConnectionThread::fromApplication(), }; @@ -67,6 +74,7 @@ WaylandIntegration::WaylandIntegration() _private->interfacesLoop.quit(); } }); +#endif // Qt < 6.0.0 } WaylandIntegration::~WaylandIntegration() = default; @@ -78,15 +86,21 @@ WaylandIntegration *WaylandIntegration::Instance() { } void WaylandIntegration::waitForInterfaceAnnounce() { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Expects(!_private->interfacesLoop.isRunning()); if (!_private->interfacesAnnounced) { _private->interfacesLoop.exec(); } +#endif // Qt < 6.0.0 } bool WaylandIntegration::xdgDecorationSupported() { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) return _private->registry.hasInterface( Registry::Interface::XdgDecorationUnstableV1); +#else // Qt < 6.0.0 + return false; +#endif // Qt >= 6.0.0 } bool WaylandIntegration::windowExtentsSupported() {