Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
74 Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyPressEvent(uint unicode);
75 Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyReleaseEvent(uint unicode);
76
77 uint sendTouchPointEvent(QWaylandSurface *surface, int id, const QPointF &point, Qt::TouchPointState state);
78 Q_INVOKABLE uint sendTouchPointPressed(QWaylandSurface *surface, int id, const QPointF &position);
79 Q_INVOKABLE uint sendTouchPointReleased(QWaylandSurface *surface, int id, const QPointF &position);
80 Q_INVOKABLE uint sendTouchPointMoved(QWaylandSurface *surface, int id, const QPointF &position);
81 Q_INVOKABLE void sendTouchFrameEvent(QWaylandClient *client);
82 Q_INVOKABLE void sendTouchCancelEvent(QWaylandClient *client);
83
84 void sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *event);
85
86 QWaylandPointer *pointer() const;
87 //Normally set by the mouse device,
88 //But can be set manually for use with touch or can reset unset the current mouse focus;
89 QWaylandView *mouseFocus() const;
90 void setMouseFocus(QWaylandView *view);
91
92 QWaylandKeyboard *keyboard() const;
93 QWaylandSurface *keyboardFocus() const;
94 bool setKeyboardFocus(QWaylandSurface *surface);
95 QWaylandKeymap *keymap();
96
97 QWaylandTouch *touch() const;
98
100
101#if QT_CONFIG(draganddrop)
102 QWaylandDrag *drag() const;
103#endif
104
105 QWaylandSeat::CapabilityFlags capabilities() const;
106
107 virtual bool isOwner(QInputEvent *inputEvent) const;
108
109 static QWaylandSeat *fromSeatResource(struct ::wl_resource *resource);
110
112 void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
114#if QT_DEPRECATED_SINCE(6, 1)
115 void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
116#endif
117 void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client);
118
119private:
120 void sendUnicodeKeyEvent(uint unicode, QEvent::Type type);
121
122 void handleMouseFocusDestroyed();
123};
124
125Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags)
126
128
129#endif // QWAYLANDSEAT_H
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
\inmodule QtGui
Definition qevent.h:49
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
\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)
Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyPressEvent(uint unicode)
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.
Definition qcompare.h:63
MouseButton
Definition qnamespace.h:56
Orientation
Definition qnamespace.h:98
@ Keyboard
static bool initialize()
Definition qctf.cpp:94
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
static QOpenGLCompositor * compositor
GLenum type
GLfloat GLfloat GLfloat GLfloat h
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:34
QQuickView * view
[0]