Make Compositor::finish more generic

Summary:
KWin is not only an X11 compositing window manager, but also a Wayland
compositor. The Compositor class is used in both cases so in general it
would be nice to keep it as much as possible generic.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19879
This commit is contained in:
Vlad Zagorodniy 2019-03-19 12:02:45 +02:00
parent b617613bf7
commit fd20c59ada
2 changed files with 15 additions and 11 deletions

View file

@ -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);
}

View file

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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<unsigned long>(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()