From 1caf9f61d680e893631abea0f14e4efdf9e6d3db Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 3 Nov 2020 11:56:57 +0100 Subject: [PATCH] Disable bouncy cursor effect during ksplash Since commit commits.kde.org/plasma-workspace/378309e666f52fc436c75648a9e6ad7d5dcbacdf ksmserver sets a desktopname when restoring applications. This causes the effect to draw above the splash windows while no cursor is visible. --- effects/startupfeedback/startupfeedback.cpp | 16 +++++++++++++++- effects/startupfeedback/startupfeedback.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index d3fce09cad..595bda70ec 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -3,12 +3,15 @@ This file is part of the KDE project. SPDX-FileCopyrightText: 2010 Martin Gräßlin + SPDX-FileCopyrightText: 2020 David Redondo SPDX-License-Identifier: GPL-2.0-or-later */ #include "startupfeedback.h" // Qt #include +#include +#include #include #include #include @@ -70,6 +73,7 @@ StartupFeedbackEffect::StartupFeedbackEffect() , m_blinkingShader(nullptr) , m_cursorSize(24) , m_configWatcher(KConfigWatcher::create(KSharedConfig::openConfig("klaunchrc", KConfig::NoGlobals))) + , m_splashVisible(false) { for (int i = 0; i < 5; ++i) { m_bouncingTextures[i] = nullptr; @@ -87,6 +91,16 @@ StartupFeedbackEffect::StartupFeedbackEffect() }); reconfigure(ReconfigureAll); + m_splashVisible = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.KSplash")); + auto serviceWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.KSplash"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); + connect(serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this] { + m_splashVisible = true; + stop(); + }); + connect(serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this] { + m_splashVisible = false; + gotRemoveStartup(KStartupInfoId(), KStartupInfoData()); // Start the next feedback + }); } StartupFeedbackEffect::~StartupFeedbackEffect() @@ -258,7 +272,7 @@ void StartupFeedbackEffect::gotStartupChange(const KStartupInfoId& id, const KSt void StartupFeedbackEffect::start(const QString& icon) { - if (m_type == NoFeedback) + if (m_type == NoFeedback || m_splashVisible) return; if (!m_active) effects->startMousePolling(); diff --git a/effects/startupfeedback/startupfeedback.h b/effects/startupfeedback/startupfeedback.h index 81070eb9da..215e882bcd 100644 --- a/effects/startupfeedback/startupfeedback.h +++ b/effects/startupfeedback/startupfeedback.h @@ -78,6 +78,7 @@ private: GLShader *m_blinkingShader; int m_cursorSize; KConfigWatcher::Ptr m_configWatcher; + bool m_splashVisible; }; } // namespace