Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwaylandseat.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWAYLANDSEAT_H
5#define QWAYLANDSEAT_H
6
7#include <QtCore/qnamespace.h>
8#include <QtCore/QPoint>
9#include <QtCore/QString>
10
11#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
12#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
13#include <QtWaylandCompositor/qwaylandcompositorextension.h>
14#include <QtWaylandCompositor/qwaylandkeyboard.h>
15#include <QtWaylandCompositor/qwaylandview.h>
16
18
20class QWaylandSurface;
21class QKeyEvent;
22class QTouchEvent;
23class QInputEvent;
25class QWaylandDrag;
27class QWaylandPointer;
28class QWaylandTouch;
29
30class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
31{
33 Q_DECLARE_PRIVATE(QWaylandSeat)
34
35#if QT_CONFIG(draganddrop)
36 Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT)
37 Q_MOC_INCLUDE("qwaylanddrag.h")
38#endif
39 Q_PROPERTY(QWaylandKeymap *keymap READ keymap CONSTANT)
40 Q_MOC_INCLUDE("qwaylandkeymap.h")
41 Q_MOC_INCLUDE("qwaylandview.h")
42
43 QML_NAMED_ELEMENT(WaylandSeat)
46public:
48 // The order should match the enum WL_SEAT_CAPABILITY_*
49 Pointer = 0x01,
50 Keyboard = 0x02,
51 Touch = 0x04,
52
53 DefaultCapabilities = Pointer | Keyboard | Touch
54 };
55 Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
56 Q_ENUM(CapabilityFlags)
57
58 QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities);
59 ~QWaylandSeat() override;
60 virtual void initialize();
61 bool isInitialized() const;
62
63 void sendMousePressEvent(Qt::MouseButton button);
64 void sendMouseReleaseEvent(Qt::MouseButton button);
65 void sendMouseMoveEvent(QWaylandView *surface , const QPointF &localPos, const QPointF &outputSpacePos = QPointF());
66 void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
67
68 void sendKeyPressEvent(uint code);
69 void sendKeyReleaseEvent(uint code);
70
71 void sendFullKeyEvent(QKeyEvent *event);
72 Q_INVOKABLE void sendKeyEvent(int qtKey, bool pressed);
73 Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyEvent(uint unicode, bool pressed);
74
75 uint sendTouchPointEvent(QWaylandSurface *surface, int id, const QPointF &point, Qt::TouchPointState state);
76 Q_INVOKABLE uint sendTouchPointPressed(QWaylandSurface *surface, int id, const QPointF &position);
77 Q_INVOKABLE uint sendTouchPointReleased(QWaylandSurface *surface, int id, const QPointF &position);
78 Q_INVOKABLE uint sendTouchPointMoved(QWaylandSurface *surface, int id, const QPointF &position);
79 Q_INVOKABLE void sendTouchFrameEvent(QWaylandClient *client);
80 Q_INVOKABLE void sendTouchCancelEvent(QWaylandClient *client);
81
82 void sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *event);
83
84 QWaylandPointer *pointer() const;
85 //Normally set by the mouse device,
86 //But can be set manually for use with touch or can reset unset the current mouse focus;
87 QWaylandView *mouseFocus() const;
88 void setMouseFocus(QWaylandView *view);
89
90 QWaylandKeyboard *keyboard() const;
91 QWaylandSurface *keyboardFocus() const;
92 bool setKeyboardFocus(QWaylandSurface *surface);
93 QWaylandKeymap *keymap();
94
95 QWaylandTouch *touch() const;
96
98
99#if QT_CONFIG(draganddrop)
100 QWaylandDrag *drag() const;
101#endif
102
103 QWaylandSeat::CapabilityFlags capabilities() const;
104
105 virtual bool isOwner(QInputEvent *inputEvent) const;
106
107 static QWaylandSeat *fromSeatResource(struct ::wl_resource *resource);
108
110 void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
112#if QT_DEPRECATED_SINCE(6, 1)
113 void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
114#endif
115 void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client);
116
117private:
118 void handleMouseFocusDestroyed();
119};
120
121Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags)
122
124
125#endif // QWAYLANDSEAT_H
\inmodule QtGui
Definition qevent.h:49
The QKeyEvent class describes a key event.
Definition qevent.h:423
\inmodule QtCore\reentrant
Definition qpoint.h:214
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:916
\qmltype WaylandClient \instantiates QWaylandClient \inqmlmodule QtWayland.Compositor
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
\inmodule QtWaylandCompositor
\inmodule QtWaylandCompositor
\inmodule QtWaylandCompositor
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus)
\qmlsignal void QtWayland.Compositor::WaylandSeat::keyboardFocusChanged(QWaylandSurface newFocus,...
CapabilityFlag
This enum type describes the capabilities of a QWaylandSeat.
void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client)
void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus)
This signal is emitted when the mouse focus has changed from oldFocus to newFocus.
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
\inmodule QtWaylandCompositor
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
QPushButton * button
[2]
else opt state
[0]
Combined button and popup list for selecting options.
MouseButton
Definition qnamespace.h:55
Orientation
Definition qnamespace.h:97
@ Keyboard
static bool initialize()
Definition qctf.cpp:67
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
static QOpenGLCompositor * compositor
struct _cl_event * event
GLsizei const void * pointer
Definition qopenglext.h:384
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QString qtKey(CFStringRef cfkey)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_INVOKABLE
#define Q_MOC_INCLUDE(...)
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:29
QQuickView * view
[0]