1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWAYLANDPOINTER_H
5#define QWAYLANDPOINTER_H
6
7#include <QtWaylandCompositor/QWaylandCompositorExtension>
8
9struct wl_resource;
10
11QT_BEGIN_NAMESPACE
12
13class QWaylandPointer;
14class QWaylandPointerPrivate;
15class QWaylandSeat;
16class QWaylandView;
17class QWaylandOutput;
18class QWaylandClient;
19
20class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPointer : public QWaylandObject
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(QWaylandPointer)
24 Q_PROPERTY(bool isButtonPressed READ isButtonPressed NOTIFY buttonPressedChanged)
25public:
26 QWaylandPointer(QWaylandSeat *seat, QObject *parent = nullptr);
27
28 QWaylandSeat *seat() const;
29 QWaylandCompositor *compositor() const;
30
31 QWaylandOutput *output() const;
32 void setOutput(QWaylandOutput *output);
33
34 virtual uint sendMousePressEvent(Qt::MouseButton button);
35 virtual uint sendMouseReleaseEvent(Qt::MouseButton button);
36 virtual void sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos);
37 virtual void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
38
39 QWaylandView *mouseFocus() const;
40 QPointF currentLocalPosition() const;
41 QPointF currentSpacePosition() const;
42
43 bool isButtonPressed() const;
44
45 virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version);
46
47 wl_resource *focusResource() const;
48
49 static uint32_t toWaylandButton(Qt::MouseButton button);
50 uint sendButton(struct wl_resource *resource, uint32_t time, Qt::MouseButton button, uint32_t state);
51Q_SIGNALS:
52 void outputChanged();
53 void buttonPressedChanged();
54
55private:
56 void enteredSurfaceDestroyed(void *data);
57 void pointerFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
58};
59
60QT_END_NAMESPACE
61
62#endif /*QWAYLANDPOINTER_H*/
63

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