Re-enable kwayland with Qt 6

This commit is contained in:
Ilya Fedin 2021-10-25 07:36:45 +04:00 committed by John Preston
parent 397be4f175
commit 9e4ffb81a5
2 changed files with 1 additions and 21 deletions

View file

@ -259,14 +259,8 @@ elseif(LINUX)
target_link_libraries(lib_ui target_link_libraries(lib_ui
PUBLIC PUBLIC
desktop-app::lib_waylandshells 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() endif()
target_include_directories(lib_ui target_include_directories(lib_ui

View file

@ -24,34 +24,27 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <private/qwaylandwindow_p.h> #include <private/qwaylandwindow_p.h>
#include <private/qwaylandshellsurface_p.h> #include <private/qwaylandshellsurface_p.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <connection_thread.h> #include <connection_thread.h>
#include <registry.h> #include <registry.h>
#endif // Qt < 6.0.0
Q_DECLARE_METATYPE(QMargins); Q_DECLARE_METATYPE(QMargins);
using QtWaylandClient::QWaylandIntegration; using QtWaylandClient::QWaylandIntegration;
using QtWaylandClient::QWaylandWindow; using QtWaylandClient::QWaylandWindow;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
using namespace KWayland::Client; using namespace KWayland::Client;
#endif // Qt < 6.0.0
namespace Ui { namespace Ui {
namespace Platform { namespace Platform {
struct WaylandIntegration::Private { struct WaylandIntegration::Private {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
std::unique_ptr<ConnectionThread> connection; std::unique_ptr<ConnectionThread> connection;
Registry registry; Registry registry;
QEventLoop interfacesLoop; QEventLoop interfacesLoop;
bool interfacesAnnounced = false; bool interfacesAnnounced = false;
#endif // Qt < 6.0.0
}; };
WaylandIntegration::WaylandIntegration() WaylandIntegration::WaylandIntegration()
: _private(std::make_unique<Private>()) { : _private(std::make_unique<Private>()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
_private->connection = std::unique_ptr<ConnectionThread>{ _private->connection = std::unique_ptr<ConnectionThread>{
ConnectionThread::fromApplication(), ConnectionThread::fromApplication(),
}; };
@ -74,7 +67,6 @@ WaylandIntegration::WaylandIntegration()
_private->interfacesLoop.quit(); _private->interfacesLoop.quit();
} }
}); });
#endif // Qt < 6.0.0
} }
WaylandIntegration::~WaylandIntegration() = default; WaylandIntegration::~WaylandIntegration() = default;
@ -86,21 +78,15 @@ WaylandIntegration *WaylandIntegration::Instance() {
} }
void WaylandIntegration::waitForInterfaceAnnounce() { void WaylandIntegration::waitForInterfaceAnnounce() {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Expects(!_private->interfacesLoop.isRunning()); Expects(!_private->interfacesLoop.isRunning());
if (!_private->interfacesAnnounced) { if (!_private->interfacesAnnounced) {
_private->interfacesLoop.exec(); _private->interfacesLoop.exec();
} }
#endif // Qt < 6.0.0
} }
bool WaylandIntegration::xdgDecorationSupported() { bool WaylandIntegration::xdgDecorationSupported() {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return _private->registry.hasInterface( return _private->registry.hasInterface(
Registry::Interface::XdgDecorationUnstableV1); Registry::Interface::XdgDecorationUnstableV1);
#else // Qt < 6.0.0
return false;
#endif // Qt >= 6.0.0
} }
bool WaylandIntegration::windowExtentsSupported() { bool WaylandIntegration::windowExtentsSupported() {