[kwineffects] Add hide/show cursor to EffectsHandler

Summary:
The implementation delegates to the Platform to perform the actual
show/hide of the cursor image.

This replaces the implementation in the zoom effect which so far
directly interacted with xfixes to show/hide the cursor. This is now
provided by the x11/standalone platform. And due to this change the zoom
effect can now properly hide the cursor on platform DRM (wayland) as
well.

Test Plan: Zoom effect on Wayland hides the cursor

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3120
icc-effect-5.14.5
Martin Gräßlin 2016-10-20 10:25:37 +02:00
parent e90e596864
commit bedc01b108
5 changed files with 33 additions and 3 deletions

View File

@ -241,6 +241,10 @@ public:
return KWin::PlatformCursorImage();
}
void hideCursor() override {}
void showCursor() override {}
private:
bool m_animationsSuported = true;
};

View File

@ -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
//****************************************

View File

@ -230,6 +230,9 @@ public:
PlatformCursorImage cursorImage() const override;
void hideCursor() override;
void showCursor() override;
Scene *scene() const {
return m_scene;
}

View File

@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#endif
#include <xcb/xfixes.h>
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;
}

View File

@ -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
**/