From 0db071c218aced78729ae46b9ee7b6e0b535aef6 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Tue, 16 Apr 2019 02:34:27 +0300 Subject: [PATCH] Move Unmanaged-specific hack away from Toplevel::setupCompositing Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D20590 --- composite.cpp | 7 ------- unmanaged.cpp | 15 +++++++++++++++ unmanaged.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/composite.cpp b/composite.cpp index 99276797de..4f1f7d771e 100644 --- a/composite.cpp +++ b/composite.cpp @@ -960,13 +960,6 @@ bool Toplevel::setupCompositing() Compositor::self()->scene()->addToplevel(this); - // With unmanaged windows there is a race condition between the client painting the window - // and us setting up damage tracking. If the client wins we won't get a damage event even - // though the window has been painted. To avoid this we mark the whole window as damaged - // and schedule a repaint immediately after creating the damage object. - if (dynamic_cast(this)) - addDamageFull(); - return true; } diff --git a/unmanaged.cpp b/unmanaged.cpp index 8568690a59..59214d675c 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -185,5 +185,20 @@ QWindow *Unmanaged::findInternalWindow() const return nullptr; } +bool Unmanaged::setupCompositing() +{ + if (!Toplevel::setupCompositing()) { + return false; + } + + // With unmanaged windows there is a race condition between the client painting the window + // and us setting up damage tracking. If the client wins we won't get a damage event even + // though the window has been painted. To avoid this we mark the whole window as damaged + // and schedule a repaint immediately after creating the damage object. + addDamageFull(); + + return true; +} + } // namespace diff --git a/unmanaged.h b/unmanaged.h index a73d2d2722..d7aa3a5464 100644 --- a/unmanaged.h +++ b/unmanaged.h @@ -49,6 +49,8 @@ public: NET::WindowType windowType(bool direct = false, int supported_types = 0) const; bool isOutline() const override; + bool setupCompositing() override; + public Q_SLOTS: void release(ReleaseReason releaseReason = ReleaseReason::Release); protected: