From b8410dd23918a05844c06ffe44921d61df5cdd8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 2 May 2018 14:41:00 +0200 Subject: [PATCH 1/4] Client tests: Ensure there are no leftover ivi_surfaces Similarly to what we do for xdg-shell v6. Change-Id: Id72d0af53c7bcee461b741341bf6b587ffe98522 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 978a9d5e629..a8e2d5e19dd 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -162,6 +162,7 @@ public slots: // make sure the surfaces from the last test are properly cleaned up // and don't show up as false positives in the next test QTRY_VERIFY(!compositor->surface()); + QTRY_VERIFY(!compositor->iviSurface()); QTRY_VERIFY(!compositor->xdgToplevelV6()); } From 6b54806003b4d65faa0c8921c699a1b73e98e507 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 25 May 2018 13:54:22 +0200 Subject: [PATCH 2/4] Correct the include for QInternalMimeData Since qtbase/9f27bfb3, users of QInternalMimeData should include qinternalmimedata_p.h. Change-Id: I531d5fa318f55497b955b03c7e25d51a6f87ba05 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 3e88b8f4ba2..5412400a59e 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include From 19403799d778d3c26eefd5b2998221999e4e28de Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 31 May 2018 11:20:28 +0200 Subject: [PATCH 3/4] Don't ask libwayland to set absurdly long window titles It will cause libwayland to terminate the application. Task-number: QTBUG-68715 Change-Id: I1d1830453da224bec8bf4c5d6ab087c0e05328a8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 ++++++++++++- tests/auto/wayland/client/tst_client.cpp | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fdfd66688fe..5d658f675d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -287,7 +287,18 @@ void QWaylandWindow::setWindowTitle(const QString &title) { if (mShellSurface) { const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH - mShellSurface->setTitle(formatWindowTitle(title, separator)); + const QString formatted = formatWindowTitle(title, separator); + + const int libwaylandMaxBufferSize = 4096; + // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side + const int maxLength = libwaylandMaxBufferSize - 100; + + auto truncated = QStringRef(&formatted).left(maxLength); + if (truncated.length() < formatted.length()) { + qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." + << "Truncating window title (from" << formatted.length() << "chars)"; + } + mShellSurface->setTitle(truncated.toString()); } if (mWindowDecoration && window()->isVisible()) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index a8e2d5e19dd..dcc0cb773d6 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -181,6 +181,7 @@ private slots: void hiddenTransientParent(); void hiddenPopupParent(); void glWindow(); + void longWindowTitle(); private: MockCompositor *compositor = nullptr; @@ -582,6 +583,16 @@ void tst_WaylandClient::glWindow() QTRY_VERIFY(!compositor->surface()); } +void tst_WaylandClient::longWindowTitle() +{ + // See QTBUG-68715 + QWindow window; + QString absurdlyLongTitle(10000, QLatin1Char('z')); + window.setTitle(absurdlyLongTitle); + window.show(); + QTRY_VERIFY(compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From e16b3c1cc1b00296d3591a0c4ac900a8c9c53eba Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 17 May 2018 13:27:55 +0200 Subject: [PATCH 4/4] Add support for building QtWayland on macOS Change-Id: I98aadd5019e913bf0adcf0122b7b209981926278 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 35085a7f0d5..0c732c02078 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -135,7 +135,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T } int pipefd[2]; - if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + if (qt_safe_pipe(pipefd, O_NONBLOCK) == -1) { qWarning("QWaylandMimeData: pipe2() failed"); return QVariant(); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b804988b2cf..6b2faf0c449 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -52,7 +52,12 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" -#include +#if defined(Q_OS_MACOS) +# include +# include +#else +# include +#endif #include #include @@ -121,7 +126,11 @@ public: }; QWaylandIntegration::QWaylandIntegration() +#if defined(Q_OS_MACOS) + : mFontDb(new QCoreTextFontDatabaseEngineFactory) +#else : mFontDb(new QGenericUnixFontDatabase()) +#endif , mNativeInterface(new QWaylandNativeInterface(this)) #if QT_CONFIG(accessibility) , mAccessibility(new QPlatformAccessibility())