mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
mobileshell: Split out minimized geometry unset from window minimize
This commit is contained in:
parent
8d43419803
commit
7871212461
3 changed files with 36 additions and 15 deletions
|
|
@ -141,7 +141,8 @@ Item {
|
|||
}
|
||||
|
||||
function minimizeAll() {
|
||||
MobileShell.WindowUtil.minimizeAll(root);
|
||||
MobileShell.WindowUtil.unsetAllMinimizedGeometries(root);
|
||||
MobileShell.WindowUtil.minimizeAll();
|
||||
}
|
||||
|
||||
//END functions
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue