1// Copyright (C) 2017 The Qt Company Ltd.
2// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QWAYLANDPOINTER_P_H
6#define QWAYLANDPOINTER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
20#include <QtWaylandCompositor/QWaylandDestroyListener>
21#include <QtWaylandCompositor/QWaylandPointer>
22
23#include <QtCore/QList>
24#include <QtCore/QPoint>
25#include <QtCore/QObject>
26#include <QtCore/private/qobject_p.h>
27
28#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
29#include <QtWaylandCompositor/QWaylandView>
30#include <QtWaylandCompositor/QWaylandSurface>
31#include <QtWaylandCompositor/QWaylandSeat>
32
33#include <stdint.h>
34
35QT_BEGIN_NAMESPACE
36
37class QWaylandView;
38
39class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate
40 , public QtWaylandServer::wl_pointer
41{
42 Q_DECLARE_PUBLIC(QWaylandPointer)
43public:
44 QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat);
45
46 QWaylandCompositor *compositor() const { return seat->compositor(); }
47
48protected:
49 void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override;
50 void pointer_release(Resource *resource) override;
51
52private:
53 uint sendButton(Qt::MouseButton button, uint32_t state);
54 void sendMotion();
55 void sendEnter(QWaylandSurface *surface);
56 void sendLeave();
57 void ensureEntered(QWaylandSurface *surface);
58
59 QWaylandSeat *seat = nullptr;
60 QWaylandOutput *output = nullptr;
61 QPointer<QWaylandSurface> enteredSurface;
62
63 QPointF localPosition;
64 QPointF spacePosition;
65
66 uint enterSerial = 0;
67
68 int buttonCount = 0;
69
70 QWaylandDestroyListener enteredSurfaceDestroyListener;
71
72 static QWaylandSurfaceRole s_role;
73};
74
75QT_END_NAMESPACE
76
77#endif // QWAYLANDPOINTER_P_H
78

source code of qtwayland/src/compositor/compositor_api/qwaylandpointer_p.h