diff --git a/shell_client.cpp b/shell_client.cpp
index 5628707ea5..185e3cc437 100644
--- a/shell_client.cpp
+++ b/shell_client.cpp
@@ -25,10 +25,12 @@ along with this program. If not, see .
#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
@@ -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();
}
diff --git a/workspace.cpp b/workspace.cpp
index 82b493f6a1..f7bc1bc7ee 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -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
diff --git a/workspace.h b/workspace.h
index fdcf03afcf..bef70a9835 100644
--- a/workspace.h
+++ b/workspace.h
@@ -553,6 +553,7 @@ private:
QList session;
void updateXStackingOrder();
+ void updateTabbox();
AbstractClient* active_client;
AbstractClient* last_active_client;