From c85bb35c9830eb736f8f45fb8be6a1b365fcbb81 Mon Sep 17 00:00:00 2001 From: Fushan Wen Date: Fri, 4 Feb 2022 22:11:42 +0800 Subject: [PATCH] workspace: Add `animated` in `setShowingDesktop` When `animated` is false, "Show Desktop Animation" should not be played. --- src/workspace.cpp | 4 ++-- src/workspace.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/workspace.cpp b/src/workspace.cpp index 8ecc2dc046..c23356931c 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -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); } } diff --git a/src/workspace.h b/src/workspace.h index 1218a9d82a..ee72ddefa7 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -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