Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandcursorsurface_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDCURSORSURFACE_H
5#define QWAYLANDCURSORSURFACE_H
6
9
11
12namespace QtWaylandClient {
13
14#if QT_CONFIG(cursor)
15template <typename InputDevice>
16class CursorSurface : public QWaylandSurface
17{
18public:
21 {
23 }
24
25 void reset()
26 {
27 m_setSerial = 0;
28 m_hotspot = QPoint();
29 }
30
31 // Size and hotspot are in surface coordinates
32 void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale,
33 bool animated = false)
34 {
35 // Calling code needs to ensure buffer scale is supported if != 1
36 Q_ASSERT(bufferScale == 1 || version() >= 3);
37
43 }
44
45 if (version() >= 3)
47
48 attach(buffer, 0, 0);
49 damage(0, 0, size.width(), size.height());
51 if (animated) {
55 }));
56 }
57 commit();
58 }
59
60 int outputScale() const
61 {
62 int scale = 0;
63 for (auto *screen : m_screens)
65 return scale;
66 }
67
68private:
70 InputDevice *m_pointer = nullptr;
71 uint m_setSerial = 0;
73};
74
75#endif // QT_CONFIG(cursor)
76
77} // namespace QtWaylandClient
78
79QT_END_NAMESPACE
80
81#endif // QWAYLANDCURSORSURFACE_H
EnterEvent(QWaylandWindow *surface, const QPointF &local, const QPointF &global)
LeaveEvent(QWaylandWindow *surface, const QPointF &localPos, const QPointF &globalPos)
MotionEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
PressEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
ReleaseEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, bool inverted)
void callback_done(uint32_t callback_data) override
WlCallback(::wl_callback *callback, std::function< void(uint32_t)> fn)
Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland")
static const int MaxTouchPoints
Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput)