diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2016-03-02 11:04:10 +0100 |
---|---|---|
committer | Martin Gräßlin <mgraesslin@kde.org> | 2016-03-17 06:40:40 +0000 |
commit | 9cbd553eeb758bb060514f17d4615003da16429a (patch) | |
tree | c5dfb0fbf3f510881155150532bb51c7c1bf49e5 /src/client/qwaylandwindow.cpp | |
parent | 759822f33f56acb3e2bacf19c6431ea4fa2be229 (diff) |
Add support for bitmap cursors
So far QtWayland did not support custom bitmap/pixmap QCursors.
This change adds support for them by creating a QWaylandShmBuffer and
copying the pixmap data into that buffer. The internal API to set
cursors images is changed to not only rely on wl_cursor_image, but also
allow to just set the buffer with a specific size and a hot spot.
The created WaylandShmBuffer is passed around as a shared pointer, so
that it can be automatically cleaned up once the cursor image is no
longer used on any seat.
Task-number: QTBUG-51604
Change-Id: I1f1ee87f03186c3d564468d3e8ea2a3141d7e2fb
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Johan Helsing <johan.helsing@theqtcompany.com>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index caf24c0aa..68fea2fac 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -73,7 +73,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mWindowDecoration(0) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) - , m_cursorShape(Qt::ArrowCursor) + , m_cursor(Qt::ArrowCursor) , mWaitingForFrameSync(false) , mFrameCallback(0) , mRequestResizeSent(false) @@ -732,17 +732,17 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } } -void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape) +void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - if (m_cursorShape != shape || device->serial() > device->cursorSerial()) { - device->setCursor(shape, mScreen); - m_cursorShape = shape; + if (device->serial() >= device->cursorSerial()) { + device->setCursor(cursor, mScreen); + m_cursor = cursor; } } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) { - setMouseCursor(device, window()->cursor().shape()); + setMouseCursor(device, window()->cursor()); } void QWaylandWindow::requestActivateWindow() |