diff options
author | Liang Qi <liang.qi@qt.io> | 2018-06-13 12:03:52 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-13 12:03:52 +0200 |
commit | c5c6c9bc7074ee66e98d551ae13f999a6b8f7577 (patch) | |
tree | a0ff80433c570bb8d4bf2bec4fe29dab19513aae /src/client/qwaylandwindow.cpp | |
parent | f96198104d37e94cb7c4198ac7546e7301f849a3 (diff) | |
parent | db7b958fb2d82a85ef45eba852cf411ebde852bf (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
.qmake.conf
Change-Id: I6596d1a127cc93e53ec30cd881da1810cb8076d5
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ef49e8ea8..e07133063 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -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()) |