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
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// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDSEAT_H
6#define QWAYLANDSEAT_H
7
8#include <QtCore/qnamespace.h>
9#include <QtCore/QPoint>
10#include <QtCore/QString>
11
12#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
13#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
14#include <QtWaylandCompositor/qwaylandcompositorextension.h>
15#include <QtWaylandCompositor/qwaylandkeyboard.h>
16#include <QtWaylandCompositor/qwaylandview.h>
17
19
20class QWaylandCompositor;
21class QWaylandSurface;
22class QKeyEvent;
23class QTouchEvent;
24class QInputEvent;
25class QWaylandSeatPrivate;
26class QWaylandDrag;
27class QWaylandKeyboard;
28class QWaylandPointer;
29class QWaylandTouch;
30
31class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
32{
33 Q_OBJECT
34 Q_DECLARE_PRIVATE(QWaylandSeat)
35
36#if QT_CONFIG(draganddrop)
37 Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT)
38 Q_MOC_INCLUDE("qwaylanddrag.h")
39#endif
40 Q_PROPERTY(QWaylandKeymap *keymap READ keymap CONSTANT)
41 Q_MOC_INCLUDE("qwaylandkeymap.h")
42 Q_MOC_INCLUDE("qwaylandview.h")
43
44 QML_NAMED_ELEMENT(WaylandSeat)
45 QML_ADDED_IN_VERSION(1, 0)
46 QML_UNCREATABLE("")
47public:
48 enum CapabilityFlag {
49 // The order should match the enum WL_SEAT_CAPABILITY_*
50 Pointer = 0x01,
51 Keyboard = 0x02,
52 Touch = 0x04,
53
54 DefaultCapabilities = Pointer | Keyboard | Touch
55 };
56 Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
57 Q_ENUM(CapabilityFlags)
58
59 QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities);
60 ~QWaylandSeat() override;
61 virtual void initialize();
62 bool isInitialized() const;
63
64 void sendMousePressEvent(Qt::MouseButton button);
65 void sendMouseReleaseEvent(Qt::MouseButton button);
66 void sendMouseMoveEvent(QWaylandView *surface , const QPointF &localPos, const QPointF &outputSpacePos = QPointF());
67 void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
68
69 void sendKeyPressEvent(uint code);
70 void sendKeyReleaseEvent(uint code);
71
72 void sendFullKeyEvent(QKeyEvent *event);
73 Q_INVOKABLE void sendKeyEvent(int qtKey, bool pressed);
74
75 Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyPressEvent(uint unicode);
76 Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyReleaseEvent(uint unicode);
77
78 uint sendTouchPointEvent(QWaylandSurface *surface, int id, const QPointF &point, Qt::TouchPointState state);
79 Q_INVOKABLE uint sendTouchPointPressed(QWaylandSurface *surface, int id, const QPointF &position);
80 Q_INVOKABLE uint sendTouchPointReleased(QWaylandSurface *surface, int id, const QPointF &position);
81 Q_INVOKABLE uint sendTouchPointMoved(QWaylandSurface *surface, int id, const QPointF &position);
82 Q_INVOKABLE void sendTouchFrameEvent(QWaylandClient *client);
83 Q_INVOKABLE void sendTouchCancelEvent(QWaylandClient *client);
84
85 void sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *event);
86
87 QWaylandPointer *pointer() const;
88 //Normally set by the mouse device,
89 //But can be set manually for use with touch or can reset unset the current mouse focus;
90 QWaylandView *mouseFocus() const;
91 void setMouseFocus(QWaylandView *view);
92
93 QWaylandKeyboard *keyboard() const;
94 QWaylandSurface *keyboardFocus() const;
95 bool setKeyboardFocus(QWaylandSurface *surface);
96 QWaylandKeymap *keymap();
97
98 QWaylandTouch *touch() const;
99
100 QWaylandCompositor *compositor() const;
101
102#if QT_CONFIG(draganddrop)
103 QWaylandDrag *drag() const;
104#endif
105
106 QWaylandSeat::CapabilityFlags capabilities() const;
107
108 virtual bool isOwner(QInputEvent *inputEvent) const;
109
110 static QWaylandSeat *fromSeatResource(struct ::wl_resource *resource);
111
112Q_SIGNALS:
113 void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
114 void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus);
115#if QT_DEPRECATED_SINCE(6, 1)
116 void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
117#endif
118 void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client);
119
120private:
121 void sendUnicodeKeyEvent(uint unicode, QEvent::Type type);
122
123 void handleMouseFocusDestroyed();
124};
125
126Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags)
127
128QT_END_NAMESPACE
129
130#endif // QWAYLANDSEAT_H
QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const
void inputMethodEvent(QInputMethodEvent *event)
void updateInputMethod(Qt::InputMethodQueries queries)
void setSurface(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void surfaceEnabled(QWaylandSurface *surface)
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
\qmltype WaylandSeat \nativetype QWaylandSeat \inqmlmodule QtWayland.Compositor
void surfaceEnabled(QWaylandSurface *surface)
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void surfaceEnabled(QWaylandSurface *surface)
Combined button and popup list for selecting options.