From 1f0a0c893a16b05a71c4468daca8339b9d08356c Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Fri, 16 Sep 2022 01:23:48 +0300 Subject: [PATCH] effects/private: Nuke an unnecessary loop Yes, Marco, there is a more efficient way. --- src/libkwineffects/kwinquickeffect.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/libkwineffects/kwinquickeffect.cpp b/src/libkwineffects/kwinquickeffect.cpp index 4bfc370348..1cff338108 100644 --- a/src/libkwineffects/kwinquickeffect.cpp +++ b/src/libkwineffects/kwinquickeffect.cpp @@ -41,16 +41,7 @@ bool QuickSceneEffectPrivate::isItemOnScreen(QQuickItem *item, EffectScreen *scr } const QuickSceneView *view = views[screen]; - auto *rootItem = view->rootItem(); - auto candidate = item->parentItem(); - // Is there a more efficient way? - while (candidate) { - if (candidate == rootItem) { - return true; - } - candidate = candidate->parentItem(); - } - return false; + return item->window() == view->window(); } QuickSceneView::QuickSceneView(QuickSceneEffect *effect, EffectScreen *screen)