Install cursor from Effects mouse interception to Wayland surface

Unfortunately this is extremely platform specific with code for X11 and
Wayland. But at the moment it doesn't make much sense to abstract as
Effects are the only case where a fullscreen low level input area is
used.

A small problem is also that the mouse cursor doesn't get restored and
is changed when the X11 cursor changes. This will be fixed once we start
to properly track the cursor of the individual X windows.
This commit is contained in:
Martin Gräßlin 2013-06-27 10:35:15 +02:00
parent f9704ff0df
commit 9f22a99887

View file

@ -66,6 +66,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <assert.h>
#include "composite.h"
#include "xcbutils.h"
#ifdef WAYLAND_FOUND
#include "wayland_backend.h"
#endif
// dbus generated
#include "screenlocker_interface.h"
@ -768,6 +771,11 @@ void EffectsHandlerImpl::startMouseInterception(Effect *effect, Qt::CursorShape
return;
}
if (kwinApp()->operationMode() != Application::OperationModeX11) {
#ifdef WAYLAND_FOUND
if (Wayland::WaylandBackend *w = Wayland::WaylandBackend::self()) {
w->installCursorImage(shape);
}
#endif
return;
}
// NOTE: it is intended to not perform an XPointerGrab on X11. See documentation in kwineffects.h
@ -1257,6 +1265,11 @@ QSize EffectsHandlerImpl::virtualScreenSize() const
void EffectsHandlerImpl::defineCursor(Qt::CursorShape shape)
{
if (!m_mouseInterceptionWindow.isValid()) {
#ifdef WAYLAND_FOUND
if (Wayland::WaylandBackend *w = Wayland::WaylandBackend::self()) {
w->installCursorImage(shape);
}
#endif
return;
}
m_mouseInterceptionWindow.defineCursor(Cursor::x11Cursor(shape));