SHA256
1
0
forked from pool/breeze
breeze/0001-ProgressBar-Stop-emitting-polish-requests-when-item-.patch
Christophe Marin bf02b7e9b2 Accepting request 1082880 from home:Vogtinator:plasma5.27
- Add patch to avoid CPU use in idle apps (boo#1210747, kde#468903):
  * 0001-ProgressBar-Stop-emitting-polish-requests-when-item-.patch

OBS-URL: https://build.opensuse.org/request/show/1082880
OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/breeze?expand=0&rev=409
2023-04-26 20:04:41 +00:00

54 lines
1.5 KiB
Diff

From 633a368833e824bf8b62d344057d079a1f533459 Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Sun, 26 Feb 2023 00:17:53 +0300
Subject: [PATCH] ProgressBar: Stop emitting polish requests when item becomes
invisible
BUG: 468903
---
kstyle/animations/breezebusyindicatorengine.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/kstyle/animations/breezebusyindicatorengine.cpp b/kstyle/animations/breezebusyindicatorengine.cpp
index 15d110e9..7fa8300b 100644
--- a/kstyle/animations/breezebusyindicatorengine.cpp
+++ b/kstyle/animations/breezebusyindicatorengine.cpp
@@ -4,10 +4,16 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config-breeze.h"
+
#include "breezebusyindicatorengine.h"
#include "breezemetrics.h"
+#if BREEZE_HAVE_QTQUICK
+#include <QQuickItem>
+#endif
+
#include <QVariant>
namespace Breeze
@@ -32,6 +38,17 @@ bool BusyIndicatorEngine::registerWidget(QObject *object)
// connect destruction signal
connect(object, SIGNAL(destroyed(QObject *)), this, SLOT(unregisterWidget(QObject *)), Qt::UniqueConnection);
+
+#if BREEZE_HAVE_QTQUICK
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(object)) {
+ connect(item, &QQuickItem::visibleChanged, this, [=]() {
+ if (!item->isVisible()) {
+ this->setAnimated(object, false);
+ }
+ // no need for the else {} branch, as its animation will be reset anyway
+ });
+ }
+#endif
}
return true;
--
2.40.0