Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev

This commit is contained in:
Liang Qi 2018-06-13 10:04:28 +00:00 committed by The Qt Project
commit 8a14be4437
5 changed files with 36 additions and 4 deletions

View File

@ -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();
}

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtGui/private/qdnd_p.h>
#include <QtGui/private/qinternalmimedata_p.h>
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
#include <QtWaylandClient/private/qwayland-wayland.h>

View File

@ -52,7 +52,12 @@
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandscreen_p.h"
#if defined(Q_OS_MACOS)
# include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
# include <QtFontDatabaseSupport/private/qfontengine_coretext_p.h>
#else
# include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
#endif
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtThemeSupport/private/qgenericunixthemes_p.h>
@ -118,7 +123,11 @@ public:
};
QWaylandIntegration::QWaylandIntegration()
#if defined(Q_OS_MACOS)
: mFontDb(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>)
#else
: mFontDb(new QGenericUnixFontDatabase())
#endif
, mNativeInterface(new QWaylandNativeInterface(this))
#if QT_CONFIG(accessibility)
, mAccessibility(new QPlatformAccessibility())

View File

@ -282,7 +282,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())

View File

@ -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());
}
@ -181,6 +182,7 @@ private slots:
void hiddenTransientParent();
void hiddenPopupParent();
void glWindow();
void longWindowTitle();
private:
MockCompositor *compositor = nullptr;
@ -597,6 +599,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);