summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2023-12-17 17:03:15 +0100
committerGitHub <noreply@github.com>2023-12-17 17:03:15 +0100
commitc31c440fb73ae29d16c488b86dad283278bdc462 (patch)
tree1d7a6d06829e7ec9986a15c094e5e5be70037ca4
parentAdd windows code signing (diff)
parentTrigger less QEvent::ApplicationPaletteChange (diff)
downloadnheko-c31c440fb73ae29d16c488b86dad283278bdc462.tar.xz
Merge pull request #1640 from q234rty/fix-slow-new-window-plasma-6
Trigger less QEvent::ApplicationPaletteChange
-rw-r--r--src/MainWindow.cpp5
-rw-r--r--src/MainWindow.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index b7834cba..a4a0eff0 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -201,9 +201,14 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event)
     // reason?!?
     if (event->type() == QEvent::ChildAdded &&
         obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
+        QSet<QWindow *> newWindows;
         for (const auto window : QGuiApplication::topLevelWindows()) {
+            newWindows.insert(window);
+            if (m_postedWindows.contains(window))
+                continue;
             QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
         }
+        m_postedWindows.swap(newWindows);
     }
     return false;
 }
diff --git a/src/MainWindow.h b/src/MainWindow.h
index c493b5b2..928446aa 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -45,6 +45,9 @@ public:
     }
 
     bool eventFilter(QObject *obj, QEvent *event) override;
+
+private:
+    QSet<QWindow *> m_postedWindows;
 };
 
 class MainWindow : public QQuickView