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.
This commit is contained in:
David Redondo 2020-11-03 11:56:57 +01:00
parent c61ba64a9c
commit 1caf9f61d6
2 changed files with 16 additions and 1 deletions

View file

@ -3,12 +3,15 @@
This file is part of the KDE project.
SPDX-FileCopyrightText: 2010 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "startupfeedback.h"
// Qt
#include <QApplication>
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>
#include <QFile>
#include <QSize>
#include <QStyle>
@ -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();

View file

@ -78,6 +78,7 @@ private:
GLShader *m_blinkingShader;
int m_cursorSize;
KConfigWatcher::Ptr m_configWatcher;
bool m_splashVisible;
};
} // namespace