From 40839e3347e91e6193c90ae00e4c2afc1f5f967f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 31 May 2024 15:15:34 +0300 Subject: [PATCH] plugins/startupfeedback: Don't show bouncing cursor if cursor is invisible BUG: 482566 --- src/cursorsource.cpp | 5 +++++ src/cursorsource.h | 1 + src/plugins/startupfeedback/startupfeedback.cpp | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/cursorsource.cpp b/src/cursorsource.cpp index c01750ca1b..74ef4626fe 100644 --- a/src/cursorsource.cpp +++ b/src/cursorsource.cpp @@ -16,6 +16,11 @@ CursorSource::CursorSource(QObject *parent) { } +bool CursorSource::isBlank() const +{ + return m_size.isEmpty(); +} + QSizeF CursorSource::size() const { return m_size; diff --git a/src/cursorsource.h b/src/cursorsource.h index 162aa0fd54..2311f8ea8f 100644 --- a/src/cursorsource.h +++ b/src/cursorsource.h @@ -28,6 +28,7 @@ class KWIN_EXPORT CursorSource : public QObject public: explicit CursorSource(QObject *parent = nullptr); + bool isBlank() const; QSizeF size() const; QPointF hotspot() const; diff --git a/src/plugins/startupfeedback/startupfeedback.cpp b/src/plugins/startupfeedback/startupfeedback.cpp index 57b33743e7..c8044e3ca5 100644 --- a/src/plugins/startupfeedback/startupfeedback.cpp +++ b/src/plugins/startupfeedback/startupfeedback.cpp @@ -30,6 +30,8 @@ #include "core/pixelgrid.h" #include "core/rendertarget.h" #include "core/renderviewport.h" +#include "cursor.h" +#include "cursorsource.h" #include "effect/effecthandler.h" #include "opengl/glutils.h" @@ -268,6 +270,15 @@ void StartupFeedbackEffect::slotMouseChanged(const QPointF &pos, const QPointF & void StartupFeedbackEffect::gotNewStartup(const QString &id, const QIcon &icon) { + if (Cursors::self()->isCursorHidden()) { + return; + } + + const Cursor *mouse = Cursors::self()->mouse(); + if (mouse->source() && mouse->source()->isBlank()) { + return; + } + Startup &startup = m_startups[id]; startup.icon = icon; @@ -285,7 +296,9 @@ void StartupFeedbackEffect::gotNewStartup(const QString &id, const QIcon &icon) void StartupFeedbackEffect::gotRemoveStartup(const QString &id) { - m_startups.remove(id); + if (!m_startups.remove(id)) { + return; + } if (m_startups.isEmpty()) { m_currentStartup.clear(); stop();