From b19935677402a9fd14f58a2ad0d495fd57d7cb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 14 Sep 2015 11:40:48 +0200 Subject: [PATCH] Move functionality from Client::doSetDesktop to AbstractClient::setDesktop Functionality related to transient handling can now be provided by AbstractClient. --- abstract_client.cpp | 22 ++++++++++++++++++++++ client.cpp | 21 ++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index f095db81c1..928cc40099 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -304,6 +304,28 @@ void AbstractClient::setDesktop(int desktop) const bool wasOnCurrentDesktop = isOnCurrentDesktop(); m_desktop = desktop; + if (info) { + info->setDesktop(desktop); + } + if ((was_desk == NET::OnAllDesktops) != (desktop == NET::OnAllDesktops)) { + // onAllDesktops changed + workspace()->updateOnAllDesktopsOfTransients(this); + } + + auto transients_stacking_order = workspace()->ensureStackingOrder(transients()); + for (auto it = transients_stacking_order.constBegin(); + it != transients_stacking_order.constEnd(); + ++it) + (*it)->setDesktop(desktop); + + if (isModal()) // if a modal dialog is moved, move the mainwindow with it as otherwise + // the (just moved) modal dialog will confusingly return to the mainwindow with + // the next desktop change + { + foreach (AbstractClient * c2, mainClients()) + c2->setDesktop(desktop); + } + doSetDesktop(desktop, was_desk); FocusChain::self()->update(this, FocusChain::MakeFirst); diff --git a/client.cpp b/client.cpp index c81524b99f..ca05c58210 100644 --- a/client.cpp +++ b/client.cpp @@ -1211,25 +1211,8 @@ void Client::doSetSkipPager() void Client::doSetDesktop(int desktop, int was_desk) { - info->setDesktop(desktop); - if ((was_desk == NET::OnAllDesktops) != (desktop == NET::OnAllDesktops)) { - // onAllDesktops changed - workspace()->updateOnAllDesktopsOfTransients(this); - } - - auto transients_stacking_order = workspace()->ensureStackingOrder(transients()); - for (auto it = transients_stacking_order.constBegin(); - it != transients_stacking_order.constEnd(); - ++it) - (*it)->setDesktop(desktop); - - if (isModal()) // if a modal dialog is moved, move the mainwindow with it as otherwise - // the (just moved) modal dialog will confusingly return to the mainwindow with - // the next desktop change - { - foreach (AbstractClient * c2, mainClients()) - c2->setDesktop(desktop); - } + Q_UNUSED(desktop) + Q_UNUSED(was_desk) updateVisibility(); // Update states of all other windows in this group