Commit 78712124 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

mobileshell: Split out minimized geometry unset from window minimize

parent 8d434198
Pipeline #162833 passed with stages
in 1 minute and 20 seconds
......@@ -141,7 +141,8 @@ Item {
}
function minimizeAll() {
MobileShell.WindowUtil.minimizeAll(root);
MobileShell.WindowUtil.unsetAllMinimizedGeometries(root);
MobileShell.WindowUtil.minimizeAll();
}
//END functions
......
......@@ -151,31 +151,46 @@ 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()) {
if (surface) {
w->unsetMinimizedGeometry(surface);
}
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()) {
w->unsetMinimizedGeometry(surface);
}
}
void WindowUtil::updateShowingDesktop(bool showing)
{
if (showing != m_showingDesktop) {
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment