Add checks for libraries not ported to Qt 6 yet

This commit is contained in:
Ilya Fedin 2021-10-20 14:54:48 +04:00 committed by John Preston
parent 004270ebd0
commit 87b121069f
2 changed files with 21 additions and 1 deletions

View file

@ -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

View file

@ -24,27 +24,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <private/qwaylandwindow_p.h>
#include <private/qwaylandshellsurface_p.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <connection_thread.h>
#include <registry.h>
#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<ConnectionThread> connection;
Registry registry;
QEventLoop interfacesLoop;
bool interfacesAnnounced = false;
#endif // Qt < 6.0.0
};
WaylandIntegration::WaylandIntegration()
: _private(std::make_unique<Private>()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
_private->connection = std::unique_ptr<ConnectionThread>{
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() {