diff --git a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml index 344831de..4b211ff2 100644 --- a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml +++ b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml @@ -141,7 +141,8 @@ Item { } function minimizeAll() { - MobileShell.WindowUtil.minimizeAll(root); + MobileShell.WindowUtil.unsetAllMinimizedGeometries(root); + MobileShell.WindowUtil.minimizeAll(); } //END functions diff --git a/components/mobileshell/windowutil.cpp b/components/mobileshell/windowutil.cpp index d0894071..ab1362dd 100644 --- a/components/mobileshell/windowutil.cpp +++ b/components/mobileshell/windowutil.cpp @@ -151,28 +151,43 @@ void WindowUtil::requestShowingDesktop(bool showingDesktop) m_windowManagement->setShowingDesktop(showingDesktop); } -void WindowUtil::minimizeAll(QQuickItem *parent) +void WindowUtil::minimizeAll() { if (!m_windowManagement) { qWarning() << "Ignoring request for minimizing all windows since window management hasn't been announced yet!"; return; } - KWayland::Client::Surface *surface = nullptr; - if (parent) { - QWindow *window = parent->window(); - if (window) { - surface = KWayland::Client::Surface::fromWindow(window); + for (auto *w : m_windowManagement->windows()) { + if (!w->isMinimized()) { + w->requestToggleMinimized(); } } +} + +void WindowUtil::unsetAllMinimizedGeometries(QQuickItem *parent) +{ + if (!m_windowManagement) { + qWarning() << "Ignoring request for minimizing all windows since window management hasn't been announced yet!"; + return; + } + + if (!parent) { + return; + } + + QWindow *window = parent->window(); + if (!window) { + return; + } + + KWayland::Client::Surface *surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) { + return; + } for (auto *w : m_windowManagement->windows()) { - if (!w->isMinimized()) { - if (surface) { - w->unsetMinimizedGeometry(surface); - } - w->requestToggleMinimized(); - } + w->unsetMinimizedGeometry(surface); } } diff --git a/components/mobileshell/windowutil.h b/components/mobileshell/windowutil.h index 2f7af1f1..1858982f 100644 --- a/components/mobileshell/windowutil.h +++ b/components/mobileshell/windowutil.h @@ -80,11 +80,16 @@ public: Q_INVOKABLE void requestShowingDesktop(bool showingDesktop); /** - * Minimize all windows, while also unsetting their respective minimized geometries of the window given. + * Minimize all windows. + */ + Q_INVOKABLE void minimizeAll(); + + /** + * Unset minimized geometries of all windows for an item's window. * * @param parent The parent item, which is of the same window that will have geometries unset. */ - Q_INVOKABLE void minimizeAll(QQuickItem *parent); + Q_INVOKABLE void unsetAllMinimizedGeometries(QQuickItem *parent); Q_SIGNALS: void windowCreated(KWayland::Client::PlasmaWindow *window);