workspace: Add animated in setShowingDesktop

When `animated` is false, "Show Desktop Animation" should not be played.
This commit is contained in:
Fushan Wen 2022-02-04 22:11:42 +08:00
parent 1a6ebab865
commit c85bb35c98
2 changed files with 10 additions and 4 deletions

View file

@ -1398,7 +1398,7 @@ void Workspace::focusToNull()
}
}
void Workspace::setShowingDesktop(bool showing)
void Workspace::setShowingDesktop(bool showing, bool animated)
{
const bool changed = showing != showing_desktop;
if (rootInfo() && changed) {
@ -1441,7 +1441,7 @@ void Workspace::setShowingDesktop(bool showing)
}
}
if (changed) {
Q_EMIT showingDesktopChanged(showing);
Q_EMIT showingDesktopChanged(showing, animated);
}
}

View file

@ -337,7 +337,13 @@ public:
AbstractOutput *previousOutput(AbstractOutput *reference) const;
void switchToOutput(AbstractOutput *output);
void setShowingDesktop(bool showing);
/**
* Set "Show Desktop" status
*
* @param showing @c true to show the desktop, @c false to restore the window positions
* @param animated @c true if the "Show Desktop Animation" should be played, otherwise @c false
*/
void setShowingDesktop(bool showing, bool animated = true);
bool showingDesktop() const;
void removeX11Client(X11Client *); // Only called from X11Client::destroyClient() or X11Client::releaseWindow()
@ -530,7 +536,7 @@ Q_SIGNALS:
void unmanagedRemoved(KWin::Unmanaged *);
void deletedRemoved(KWin::Deleted *);
void configChanged();
void showingDesktopChanged(bool showing);
void showingDesktopChanged(bool showing, bool animated);
/**
* This signal is emitted when the stacking order changed, i.e. a window is risen
* or lowered