[wayland] Update tabbox when a client is added or closed

Summary: Update tabbox similar to how it's done in KWin/X11.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21005
This commit is contained in:
Vlad Zagorodniy 2019-07-29 21:24:09 +03:00
parent 53936854c7
commit b3bd9e7e9b
3 changed files with 25 additions and 13 deletions

View file

@ -25,10 +25,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "placement.h"
#include "screenedge.h"
#include "screens.h"
#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
#endif
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "workspace.h"
#include "virtualdesktops.h"
#include "screens.h"
#include "decorations/decorationbridge.h"
#include "decorations/decoratedclient.h"
#include <KDecoration2/Decoration>
@ -418,6 +420,12 @@ void ShellClient::finishInit() {
void ShellClient::destroyClient()
{
m_closing = true;
#ifdef KWIN_BUILD_TABBOX
TabBox::TabBox *tabBox = TabBox::TabBox::self();
if (tabBox->isDisplayed() && tabBox->currentClient() == this) {
tabBox->nextPrev(true);
}
#endif
if (isMoveResize()) {
leaveMoveResize();
}

View file

@ -322,6 +322,7 @@ void Workspace::init()
if (c->wantsInput() && !c->isMinimized()) {
activateClient(c);
}
updateTabbox();
connect(c, &ShellClient::windowShown, this,
[this, c] {
updateClientLayer(c);
@ -340,6 +341,7 @@ void Workspace::init()
);
connect(c, &ShellClient::windowHidden, this,
[this] {
// TODO: update tabbox if it's displayed
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
@ -370,6 +372,7 @@ void Workspace::init()
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
updateTabbox();
}
);
}
@ -653,10 +656,7 @@ void Workspace::addClient(Client* c)
updateStackingOrder(true); // Propagate new client
if (c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows(true);
#ifdef KWIN_BUILD_TABBOX
if (TabBox::TabBox::self()->isDisplayed())
TabBox::TabBox::self()->reset(true);
#endif
updateTabbox();
}
void Workspace::addUnmanaged(Unmanaged* c)
@ -708,14 +708,8 @@ void Workspace::removeClient(Client* c)
emit clientRemoved(c);
updateStackingOrder(true);
#ifdef KWIN_BUILD_TABBOX
TabBox::TabBox *tabBox = TabBox::TabBox::self();
if (tabBox->isDisplayed())
tabBox->reset(true);
#endif
updateClientArea();
updateTabbox();
}
void Workspace::removeUnmanaged(Unmanaged* c)
@ -1781,5 +1775,14 @@ void Workspace::setWasUserInteraction()
);
}
void Workspace::updateTabbox()
{
#ifdef KWIN_BUILD_TABBOX
if (TabBox::TabBox::self()->isDisplayed()) {
TabBox::TabBox::self()->reset(true);
}
#endif
}
} // namespace

View file

@ -553,6 +553,7 @@ private:
QList<SessionInfo*> session;
void updateXStackingOrder();
void updateTabbox();
AbstractClient* active_client;
AbstractClient* last_active_client;