diff --git a/autotests/mock_effectshandler.h b/autotests/mock_effectshandler.h
index d19f3796ca..8a0179c861 100644
--- a/autotests/mock_effectshandler.h
+++ b/autotests/mock_effectshandler.h
@@ -241,6 +241,10 @@ public:
return KWin::PlatformCursorImage();
}
+ void hideCursor() override {}
+
+ void showCursor() override {}
+
private:
bool m_animationsSuported = true;
};
diff --git a/effects.cpp b/effects.cpp
index cd687bf5c4..1a731bf649 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -1564,6 +1564,16 @@ PlatformCursorImage EffectsHandlerImpl::cursorImage() const
return kwinApp()->platform()->cursorImage();
}
+void EffectsHandlerImpl::hideCursor()
+{
+ kwinApp()->platform()->hideCursor();
+}
+
+void EffectsHandlerImpl::showCursor()
+{
+ kwinApp()->platform()->showCursor();
+}
+
//****************************************
// EffectWindowImpl
//****************************************
diff --git a/effects.h b/effects.h
index ccacc80eeb..e6a316c61a 100644
--- a/effects.h
+++ b/effects.h
@@ -230,6 +230,9 @@ public:
PlatformCursorImage cursorImage() const override;
+ void hideCursor() override;
+ void showCursor() override;
+
Scene *scene() const {
return m_scene;
}
diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp
index 6c9865bd2c..1af89efd02 100644
--- a/effects/zoom/zoom.cpp
+++ b/effects/zoom/zoom.cpp
@@ -38,7 +38,6 @@ along with this program. If not, see .
#include
#include
#endif
-#include
namespace KWin
{
@@ -153,7 +152,7 @@ void ZoomEffect::showCursor()
if (isMouseHidden) {
disconnect(effects, &EffectsHandler::cursorShapeChanged, this, &ZoomEffect::recreateTexture);
// show the previously hidden mouse-pointer again and free the loaded texture/picture.
- xcb_xfixes_show_cursor(xcbConnection(), x11RootWindow());
+ effects->showCursor();
texture.reset();
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
xrenderPicture.reset();
@@ -178,7 +177,7 @@ void ZoomEffect::hideCursor()
#endif
}
if (shouldHide) {
- xcb_xfixes_hide_cursor(xcbConnection(), x11RootWindow());
+ effects->hideCursor();
connect(effects, &EffectsHandler::cursorShapeChanged, this, &ZoomEffect::recreateTexture);
isMouseHidden = true;
}
diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h
index e96a777ea2..d57a368d35 100644
--- a/libkwineffects/kwineffects.h
+++ b/libkwineffects/kwineffects.h
@@ -1192,6 +1192,20 @@ public:
**/
virtual PlatformCursorImage cursorImage() const = 0;
+ /**
+ * The cursor image should be hidden.
+ * @see showCursor
+ * @since 5.9
+ **/
+ virtual void hideCursor() = 0;
+
+ /**
+ * The cursor image should be shown again after having been hidden..
+ * @see hideCursor
+ * @since 5.9
+ **/
+ virtual void showCursor() = 0;
+
/**
* @return @ref KConfigGroup which holds given effect's config options
**/