Add Window::captionNormalChanged()

This signal notifies when the client specified caption changes, not when
kwin changes it because it changed the suffix, etc.
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent 68f1570d45
commit 4ab504c994
  1. 1
      src/internalwindow.cpp
  2. 6
      src/waylandwindow.cpp
  3. 1
      src/window.h
  4. 7
      src/x11window.cpp

@ -476,6 +476,7 @@ void InternalWindow::setCaption(const QString &caption)
const QString oldCaptionSuffix = m_captionSuffix;
updateCaption();
Q_EMIT captionNormalChanged();
if (m_captionSuffix == oldCaptionSuffix) {
Q_EMIT captionChanged();
}

@ -204,9 +204,15 @@ void WaylandWindow::updateCaption()
void WaylandWindow::setCaption(const QString &caption)
{
const QString oldNormal = m_captionNormal;
const QString oldSuffix = m_captionSuffix;
m_captionNormal = caption.simplified();
updateCaption();
if (m_captionNormal != oldNormal) {
Q_EMIT captionNormalChanged();
}
if (m_captionSuffix == oldSuffix) {
// Don't emit caption change twice it already got emitted by the changing suffix.
Q_EMIT captionChanged();

@ -1410,6 +1410,7 @@ Q_SIGNALS:
void paletteChanged(const QPalette &p);
void colorSchemeChanged();
void captionChanged();
void captionNormalChanged();
void maximizedAboutToChange(MaximizeMode mode);
void maximizedChanged();
void transientChanged();

@ -2329,10 +2329,6 @@ void X11Window::setCaption(const QString &_s, bool force)
return;
}
cap_normal = s;
if (!force && !changed) {
Q_EMIT captionChanged();
return;
}
bool reset_name = force;
bool was_suffix = (!cap_suffix.isEmpty());
@ -2363,6 +2359,9 @@ void X11Window::setCaption(const QString &_s, bool force)
info->setVisibleIconName(QString(cap_iconic + cap_suffix).toUtf8().constData());
}
if (changed) {
Q_EMIT captionNormalChanged();
}
Q_EMIT captionChanged();
}

Loading…
Cancel
Save