KWin
Loading...
Searching...
No Matches
pointer.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
3 SPDX-FileCopyrightText: 2020 Adrien Faveraux <ad1rie3@hotmail.fr>
4 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8#pragma once
9
10#include "kwin_export.h"
11
12#include <QObject>
13#include <memory>
14
15struct wl_resource;
16
17namespace KWin
18{
19class PointerSurfaceCursorPrivate;
20class PointerSurfaceCursor;
21class PointerInterfacePrivate;
22class SeatInterface;
23class SurfaceInterface;
24
25enum class PointerAxisSource;
27enum class PointerButtonState : quint32;
28
29using PointerCursor = std::variant<PointerSurfaceCursor *, QByteArray>;
30
35class KWIN_EXPORT PointerInterface : public QObject
36{
37 Q_OBJECT
38
39public:
40 ~PointerInterface() override;
41
47 SurfaceInterface *focusedSurface() const;
48 quint32 focusedSerial() const;
49
53 SeatInterface *seat() const;
54
58 static PointerInterface *get(wl_resource *native);
59
60 void sendEnter(SurfaceInterface *surface, const QPointF &position, quint32 serial);
61 void sendLeave(quint32 serial);
62 void sendButton(quint32 button, PointerButtonState state, quint32 serial);
63 void sendAxis(Qt::Orientation orientation, qreal delta, qint32 deltaV120, PointerAxisSource source, PointerAxisRelativeDirection direction);
64 void sendMotion(const QPointF &position);
65 void sendFrame();
66
67Q_SIGNALS:
72 void cursorChanged(const PointerCursor &cursor);
77
78private:
79 explicit PointerInterface(SeatInterface *seat);
80 std::unique_ptr<PointerInterfacePrivate> d;
81
84};
85
89class KWIN_EXPORT PointerSurfaceCursor
90{
91public:
94
98 QPointF hotspot() const;
102 SurfaceInterface *surface() const;
103
104private:
105 std::unique_ptr<PointerSurfaceCursorPrivate> d;
107};
108
109} // namespace KWin
void cursorChanged(const PointerCursor &cursor)
Class encapsulating a Cursor image.
Definition pointer.h:90
Represents a Seat on the Wayland Display.
Definition seat.h:134
Resource representing a wl_surface.
Definition surface.h:80
PointerAxisSource
Definition seat.h:53
PointerButtonState
Definition seat.h:73
std::variant< PointerSurfaceCursor *, QByteArray > PointerCursor
Definition pointer.h:29
PointerAxisRelativeDirection
Definition seat.h:64