diff --git a/composite.cpp b/composite.cpp
index 4f1f7d771e..01ae756b27 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -423,17 +423,6 @@ void Compositor::finish()
m_scene = NULL;
compositeTimer.stop();
repaints_region = QRegion();
- if (Workspace::self()) {
- for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin();
- it != Workspace::self()->clientList().constEnd();
- ++it) {
- // forward all opacity values to the frame in case there'll be other CM running
- if ((*it)->opacity() != 1.0) {
- NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0, 0);
- i.setOpacity(static_cast< unsigned long >((*it)->opacity() * 0xffffffff));
- }
- }
- }
m_finishing = false;
emit compositingToggled(false);
}
diff --git a/manage.cpp b/manage.cpp
index cd0f63786c..798ad61faa 100644
--- a/manage.cpp
+++ b/manage.cpp
@@ -28,6 +28,7 @@ along with this program. If not, see .
#ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h"
#endif
+#include "composite.h"
#include "cursor.h"
#include "rules.h"
#include "group.h"
@@ -652,6 +653,20 @@ bool Client::manage(xcb_window_t w, bool isMapped)
setBlockingCompositing(info->isBlockingCompositing());
readShowOnScreenEdge(showOnScreenEdgeCookie);
+ // Forward all opacity values to the frame in case there'll be other CM running.
+ connect(Compositor::self(), &Compositor::compositingToggled, this,
+ [this](bool active) {
+ if (active) {
+ return;
+ }
+ if (opacity() == 1.0) {
+ return;
+ }
+ NETWinInfo info(connection(), frameId(), rootWindow(), 0, 0);
+ info.setOpacity(static_cast(opacity() * 0xffffffff));
+ }
+ );
+
// TODO: there's a small problem here - isManaged() depends on the mapping state,
// but this client is not yet in Workspace's client list at this point, will
// be only done in addClient()