diff --git a/autotests/wayland/shell_client_test.cpp b/autotests/wayland/shell_client_test.cpp
index 94e39c4362..525eb8a529 100644
--- a/autotests/wayland/shell_client_test.cpp
+++ b/autotests/wayland/shell_client_test.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see .
#include "shell_client.h"
#include "screens.h"
#include "wayland_server.h"
+#include "workspace.h"
#include
#include
@@ -170,6 +171,7 @@ void TestShellClient::testMapUnmapMap()
auto client = clientAddedSpy.first().first().value();
QVERIFY(client);
QVERIFY(client->isShown(true));
+ QCOMPARE(workspace()->activeClient(), client);
// now unmap
QSignalSpy hiddenSpy(client, &ShellClient::windowHidden);
@@ -180,6 +182,7 @@ void TestShellClient::testMapUnmapMap()
surface->commit(Surface::CommitFlag::None);
QVERIFY(hiddenSpy.wait());
QVERIFY(windowClosedSpy.isEmpty());
+ QVERIFY(!workspace()->activeClient());
QSignalSpy windowShownSpy(client, &ShellClient::windowShown);
QVERIFY(windowShownSpy.isValid());
@@ -190,6 +193,7 @@ void TestShellClient::testMapUnmapMap()
QVERIFY(windowShownSpy.wait());
QCOMPARE(windowShownSpy.count(), 1);
QCOMPARE(clientAddedSpy.count(), 1);
+ QCOMPARE(workspace()->activeClient(), client);
// let's unmap again
surface->attachBuffer(Buffer::Ptr());
diff --git a/workspace.cpp b/workspace.cpp
index 85fc170579..16fcf29e4b 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -394,6 +394,17 @@ void Workspace::init()
if (c->wantsInput()) {
activateClient(c);
}
+ connect(c, &ShellClient::windowShown, this,
+ [this, c] {
+ updateClientLayer(c);
+ x_stacking_dirty = true;
+ updateStackingOrder(true);
+ updateClientArea();
+ if (c->wantsInput()) {
+ activateClient(c);
+ }
+ }
+ );
}
);
connect(w, &WaylandServer::shellClientRemoved, this,