bradient: Use QWaylandWindow actual window title
It may include a suffix containing the application name and is also what's set on the XDG Toplevel, i.e. what the rest of the environment (task switcher, etc) sees. This stores the title in QWaylandWindow and adds a getter to retrieve it. Pick-to: 6.7 Change-Id: I84f41c68b16b680cdbb5cf656c7078d1e41767d4 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
b7723f14e6
commit
cc5d649c98
@ -142,7 +142,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
}
|
||||
|
||||
// Window title
|
||||
QString windowTitleText = window()->title();
|
||||
QString windowTitleText = waylandWindow()->windowTitle();
|
||||
if (!windowTitleText.isEmpty()) {
|
||||
if (m_windowTitle.text() != windowTitleText) {
|
||||
m_windowTitle.setText(windowTitleText);
|
||||
|
@ -362,9 +362,13 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
|
||||
}
|
||||
}
|
||||
|
||||
QString QWaylandWindow::windowTitle() const
|
||||
{
|
||||
return mWindowTitle;
|
||||
}
|
||||
|
||||
void QWaylandWindow::setWindowTitle(const QString &title)
|
||||
{
|
||||
if (mShellSurface) {
|
||||
const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH
|
||||
const QString formatted = formatWindowTitle(title, separator);
|
||||
|
||||
@ -379,8 +383,11 @@ void QWaylandWindow::setWindowTitle(const QString &title)
|
||||
qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported."
|
||||
<< "Truncating window title (from" << formatted.size() << "chars)";
|
||||
}
|
||||
mShellSurface->setTitle(truncated.toString());
|
||||
}
|
||||
|
||||
mWindowTitle = truncated.toString();
|
||||
|
||||
if (mShellSurface)
|
||||
mShellSurface->setTitle(mWindowTitle);
|
||||
|
||||
if (mWindowDecorationEnabled && window()->isVisible())
|
||||
mWindowDecoration->update();
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
void setVisible(bool visible) override;
|
||||
void setParent(const QPlatformWindow *parent) override;
|
||||
|
||||
QString windowTitle() const;
|
||||
void setWindowTitle(const QString &title) override;
|
||||
|
||||
inline QIcon windowIcon() const;
|
||||
@ -311,6 +312,7 @@ protected:
|
||||
qreal mScale = 1;
|
||||
QPlatformScreen *mLastReportedScreen = nullptr;
|
||||
|
||||
QString mWindowTitle;
|
||||
QIcon mWindowIcon;
|
||||
|
||||
Qt::WindowFlags mFlags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user