summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandcursor_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/qwaylandcursor_p.h')
-rw-r--r--src/client/qwaylandcursor_p.h79
1 files changed, 28 insertions, 51 deletions
diff --git a/src/client/qwaylandcursor_p.h b/src/client/qwaylandcursor_p.h
index 71f9cd1b8..1f6d5109e 100644
--- a/src/client/qwaylandcursor_p.h
+++ b/src/client/qwaylandcursor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCURSOR_H
#define QWAYLANDCURSOR_H
@@ -54,9 +18,13 @@
#include <qpa/qplatformcursor.h>
#include <QtCore/QMap>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtWaylandClient/private/qwayland-cursor-shape-v1.h>
+#include <QtCore/private/qglobal_p.h>
#if QT_CONFIG(cursor)
+#include <memory>
+
struct wl_cursor;
struct wl_cursor_image;
struct wl_cursor_theme;
@@ -70,15 +38,14 @@ class QWaylandDisplay;
class QWaylandScreen;
class QWaylandShm;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme
{
public:
- static QWaylandCursorTheme *create(QWaylandShm *shm, int size);
- static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName);
+ static std::unique_ptr<QWaylandCursorTheme> create(QWaylandShm *shm, int size, const QString &themeName);
~QWaylandCursorTheme();
- struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
+ ::wl_cursor *cursor(Qt::CursorShape shape);
-private:
+protected:
enum WaylandCursor {
ArrowCursor = Qt::ArrowCursor,
UpArrowCursor,
@@ -110,31 +77,41 @@ private:
ResizeNorthWestCursor,
ResizeSouthEastCursor,
ResizeNorthEastCursor,
- ResizeSouthWestCursor
+ ResizeSouthWestCursor,
+
+ NumWaylandCursors
};
explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {}
struct ::wl_cursor *requestCursor(WaylandCursor shape);
struct ::wl_cursor_theme *m_theme = nullptr;
- QMap<WaylandCursor, wl_cursor *> m_cursors;
+ wl_cursor *m_cursors[NumWaylandCursors] = {};
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape : public QtWayland::wp_cursor_shape_device_v1
{
public:
- QWaylandCursor(QWaylandScreen *screen);
+ QWaylandCursorShape(struct ::wp_cursor_shape_device_v1 *object);
+ ~QWaylandCursorShape();
+ void setShape(uint32_t serial, Qt::CursorShape shape);
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursor : public QPlatformCursor
+{
+public:
+ explicit QWaylandCursor(QWaylandDisplay *display);
void changeCursor(QCursor *cursor, QWindow *window) override;
void pointerEvent(const QMouseEvent &event) override;
QPoint pos() const override;
void setPos(const QPoint &pos) override;
- QSharedPointer<QWaylandBuffer> cursorBitmapImage(const QCursor *cursor);
- struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
+ QSize size() const override;
+
+ static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor);
-private:
+protected:
QWaylandDisplay *mDisplay = nullptr;
- QWaylandCursorTheme *mCursorTheme = nullptr;
QPoint mLastPos;
};