Drop usage of DecoratedClient::handle in DecorationBridge::update

We can find the Client for the Decoration without needing to go by
the handle.
This commit is contained in:
Martin Gräßlin 2014-10-21 08:03:23 +02:00
parent 21dca7ac14
commit c23b3ac0d8

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h" #include "client.h"
#include "composite.h" #include "composite.h"
#include "scene.h" #include "scene.h"
#include "workspace.h"
// KDecoration // KDecoration
#include <KDecoration2/Decoration> #include <KDecoration2/Decoration>
@ -115,8 +116,10 @@ std::unique_ptr<KDecoration2::DecorationSettingsPrivate> DecorationBridge::setti
void DecorationBridge::update(KDecoration2::Decoration *decoration, const QRect &geometry) void DecorationBridge::update(KDecoration2::Decoration *decoration, const QRect &geometry)
{ {
// TODO: remove check once all compositors implement it // TODO: remove check once all compositors implement it
if (Renderer *renderer = static_cast<DecoratedClientImpl*>(decoration->client()->handle())->renderer()) { if (Client *c = Workspace::self()->findClient([decoration] (const Client *client) { return client->decoration() == decoration; })) {
renderer->schedule(geometry); if (Renderer *renderer = c->decoratedClient()->renderer()) {
renderer->schedule(geometry);
}
} }
} }