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 <QtCore/qpointer.h>
34
35#include <stdint.h>
36
37QT_BEGIN_NAMESPACE
38
39class QWaylandView;
40
41class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate
42 , public QtWaylandServer::wl_pointer
43{
44 Q_DECLARE_PUBLIC(QWaylandPointer)
45public:
46 QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat);
47
48 QWaylandCompositor *compositor() const { return seat->compositor(); }
49
50protected:
51 void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override;
52 void pointer_release(Resource *resource) override;
53
54private:
55 uint sendButton(Qt::MouseButton button, uint32_t state);
56 void sendMotion();
57 void sendEnter(QWaylandSurface *surface);
58 void sendLeave();
59 void ensureEntered(QWaylandSurface *surface);
60
61 QWaylandSeat *seat = nullptr;
62 QWaylandOutput *output = nullptr;
63 QPointer<QWaylandSurface> enteredSurface;
64
65 QPointF localPosition;
66 QPointF spacePosition;
67
68 uint enterSerial = 0;
69
70 int buttonCount = 0;
71
72 QWaylandDestroyListener enteredSurfaceDestroyListener;
73
74 static QWaylandSurfaceRole s_role;
75};
76
77QT_END_NAMESPACE
78
79#endif // QWAYLANDPOINTER_P_H
80

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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