9#include <QtGui/QPointingDevice>
26void QWaylandTouchExtension::registerDevice(
int caps)
31 QInputDevice::Capabilities(caps), 10, 0);
41 uint32_t
id, uint32_t
state, int32_t
x, int32_t
y,
42 int32_t normalized_x, int32_t normalized_y,
44 int32_t velocity_x, int32_t velocity_y,
45 uint32_t
flags, wl_array *rawdata)
50 qWarning(
"qt_touch_extension: handle_touch: No input devices");
53 mInputDevice = inputDevices.
first();
61 qWarning(
"qt_touch_extension: handle_touch: No pointer focus");
69 int sentPointCount =
state >> 16;
72 mPointsLeft = sentPointCount;
76 registerDevice(
flags >> 16);
91 const int rawPosCount = rawdata->size /
sizeof(float) / 2;
92 float *
p =
static_cast<float *
>(rawdata->data);
93 for (
int i = 0;
i < rawPosCount; ++
i) {
107void QWaylandTouchExtension::sendTouchEvent()
110 for (
int i = 0;
i < mPrevTouchPoints.
size(); ++
i) {
115 for (
int j = 0;
j < mTouchPoints.
size(); ++
j)
116 if (mTouchPoints.
at(
j).
id == prevPoint.id) {
128 mPrevTouchPoints.
clear();
134 QEventPoint::States
states = {};
135 for (
int i = 0;
i < mTouchPoints.
size(); ++
i)
138 if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) {
141 mMouseSourceId = mTouchPoints.
first().
id;
142 for (
int i = 0;
i < mTouchPoints.
size(); ++
i) {
144 if (tp.id == mMouseSourceId) {
150 mLastMouseGlobal = tp.area.center();
152 QPointF delta = mLastMouseGlobal - globalPoint;
153 mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta;
163 mPrevTouchPoints = mTouchPoints;
164 mTouchPoints.
clear();
167 mPrevTouchPoints.
clear();
172 mTouchPoints.
clear();
173 mPrevTouchPoints.
clear();
174 if (mMouseSourceId != -1)
State
Specifies the state of this event point.
Type
This enum type defines the valid event types in Qt.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
\inmodule QtCore\reentrant
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
\inmodule QtCore\reentrant
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
\inmodule QtCore\reentrant
constexpr void moveCenter(const QPointF &p) noexcept
Moves the rectangle, leaving the center point at the given position.
constexpr void setY(float y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(float x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
static bool handleTouchEvent(QWindow *window, const QPointingDevice *device, const QList< struct TouchPoint > &points, Qt::KeyboardModifiers mods=Qt::NoModifier)
static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods=Qt::NoModifier, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized)
static void registerInputDevice(const QInputDevice *device)
QList< QWaylandInputDevice * > inputDevices() const
void touch_extension_touch(uint32_t time, uint32_t id, uint32_t state, int32_t x, int32_t y, int32_t normalized_x, int32_t normalized_y, int32_t width, int32_t height, uint32_t pressure, int32_t velocity_x, int32_t velocity_y, uint32_t flags, struct wl_array *rawdata) override
void touch_extension_configure(uint32_t flags) override
QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id)
struct wl_display * display
Combined button and popup list for selecting options.
static qreal fromFixed(int f)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
QLatin1StringView QLatin1String
QList< QPointF > rawPositions