Drop Window::{windowShown,windowHidden}

They serve the same purpose as Window::hiddenChanged, so drop these
signals instead of having multiple signals to indicate the same thing.
This commit is contained in:
Vlad Zahorodnii 2024-01-30 00:20:24 +02:00
parent a8a53c651b
commit bc62e7e094
6 changed files with 15 additions and 33 deletions

View file

@ -57,11 +57,7 @@ EffectWindow::EffectWindow(WindowItem *windowItem)
d->m_x11Window = qobject_cast<KWin::X11Window *>(d->m_window) != nullptr;
connect(d->m_window, &Window::hiddenChanged, this, [this]() {
if (d->m_window->isHidden()) {
Q_EMIT windowHidden(this);
} else {
Q_EMIT windowShown(this);
}
Q_EMIT windowHiddenChanged(this);
});
connect(d->m_window, &Window::maximizedChanged, this, [this]() {
const MaximizeMode mode = d->m_window->maximizeMode();

View file

@ -825,25 +825,9 @@ Q_SIGNALS:
void windowDesktopsChanged(KWin::EffectWindow *window);
/**
* The window @p w gets shown again. The window was previously
* initially shown with windowAdded and hidden with windowHidden.
*
* @see windowHidden
* @see windowAdded
* This signal is emitted when a window is hidden or shown.
*/
void windowShown(KWin::EffectWindow *w);
/**
* The window @p w got hidden but not yet closed.
* This can happen when a window is still being used and is supposed to be shown again
* with windowShown. On X11 an example is autohiding panels. On Wayland every
* window first goes through the window hidden state and might get shown again, or might
* get closed the normal way.
*
* @see windowShown
* @see windowClosed
*/
void windowHidden(KWin::EffectWindow *w);
void windowHiddenChanged(KWin::EffectWindow *window);
protected:
friend EffectWindowVisibleRef;

View file

@ -207,8 +207,7 @@ void SlidingPopupsEffect::postPaintWindow(EffectWindow *w)
void SlidingPopupsEffect::setupSlideData(EffectWindow *w)
{
connect(w, &EffectWindow::windowFrameGeometryChanged, this, &SlidingPopupsEffect::slotWindowFrameGeometryChanged);
connect(w, &EffectWindow::windowShown, this, &SlidingPopupsEffect::slideIn);
connect(w, &EffectWindow::windowHidden, this, &SlidingPopupsEffect::slideOut);
connect(w, &EffectWindow::windowHiddenChanged, this, &SlidingPopupsEffect::slotWindowHiddenChanged);
// X11
if (m_atom != XCB_ATOM_NONE) {
@ -249,6 +248,15 @@ void SlidingPopupsEffect::slotWindowDeleted(EffectWindow *w)
m_animationsData.remove(w);
}
void SlidingPopupsEffect::slotWindowHiddenChanged(EffectWindow *w)
{
if (w->isHidden()) {
slideOut(w);
} else {
slideIn(w);
}
}
void SlidingPopupsEffect::slotPropertyNotify(EffectWindow *w, long atom)
{
if (!w || atom != m_atom || m_atom == XCB_ATOM_NONE) {

View file

@ -55,6 +55,7 @@ private Q_SLOTS:
void slotPropertyNotify(EffectWindow *w, long atom);
void slotWaylandSlideOnShowChanged(EffectWindow *w);
void slotWindowFrameGeometryChanged(EffectWindow *w, const QRectF &);
void slotWindowHiddenChanged(EffectWindow *w);
void slideIn(EffectWindow *w);
void slideOut(EffectWindow *w);

View file

@ -72,9 +72,6 @@ Window::Window()
connect(this, &Window::interactiveMoveResizeStarted, this, &Window::moveResizedChanged);
connect(this, &Window::interactiveMoveResizeFinished, this, &Window::moveResizedChanged);
connect(this, &Window::windowShown, this, &Window::hiddenChanged);
connect(this, &Window::windowHidden, this, &Window::hiddenChanged);
connect(this, &Window::paletteChanged, this, &Window::triggerDecorationRepaint);
// If the user manually moved the window, don't restore it after the keyboard closes
@ -4290,10 +4287,8 @@ void Window::setHidden(bool hidden)
doSetHidden();
if (hidden) {
workspace()->activateNextWindow(this);
Q_EMIT windowHidden(this);
} else {
Q_EMIT windowShown(this);
}
Q_EMIT hiddenChanged();
}
bool Window::isHiddenByShowDesktop() const

View file

@ -1332,8 +1332,6 @@ Q_SIGNALS:
void damaged(KWin::Window *window);
void inputTransformationChanged();
void closed();
void windowShown(KWin::Window *window);
void windowHidden(KWin::Window *window);
/**
* Emitted whenever the Window's screen changes. This can happen either in consequence to
* a screen being removed/added or if the Window's geometry changes.