Reduce resets in DebugConsole when viewing subsurfaces

subsurfaceTreeChanged is emitted on every damage event. This makes it
very noisy and the model constantly resets. This makes it impossible to
expand the tree (as it resets immediately after).

SubSurfaceMonitor gives us more granular signals whilst handling the
recursive aspect.

Also there are no unmanaged windows that are wayland surfaces, so they
are simplified.
This commit is contained in:
David Edmundson 2020-09-15 17:36:10 +01:00
parent 3cfec5fdcf
commit 578287ec95

View file

@ -19,6 +19,7 @@
#include "workspace.h"
#include "keyboard_input.h"
#include "input_event.h"
#include "subsurfacemonitor.h"
#include "libinput/connection.h"
#include "libinput/device.h"
#include <kwinglplatform.h>
@ -1267,36 +1268,27 @@ SurfaceTreeModel::SurfaceTreeModel(QObject *parent)
};
using namespace KWaylandServer;
const auto unmangeds = workspace()->unmanagedList();
for (auto u : unmangeds) {
if (!u->surface()) {
continue;
}
connect(u->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset);
}
for (auto c : workspace()->allClientList()) {
auto watchSubsurfaces = [this, reset](AbstractClient *c) {
if (!c->surface()) {
continue;
return;
}
connect(c->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset);
auto monitor = new SubSurfaceMonitor(c->surface(), this);
connect(monitor, &SubSurfaceMonitor::subSurfaceAdded, this, reset);
connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, this, reset);
connect (c, &QObject::destroyed, monitor, &QObject::deleteLater);
};
for (auto c : workspace()->allClientList()) {
watchSubsurfaces(c);
}
connect(workspace(), &Workspace::clientAdded, this,
[this, reset] (AbstractClient *c) {
if (c->surface()) {
connect(c->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset);
}
[this, reset, watchSubsurfaces] (AbstractClient *c) {
watchSubsurfaces(c);
reset();
}
);
connect(workspace(), &Workspace::clientRemoved, this, reset);
connect(workspace(), &Workspace::unmanagedAdded, this,
[this, reset] (Unmanaged *u) {
if (u->surface()) {
connect(u->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset);
}
reset();
}
);
connect(workspace(), &Workspace::unmanagedAdded, this, reset);
connect(workspace(), &Workspace::unmanagedRemoved, this, reset);
}