7#include <QtGui/QGuiApplication>
8#include <QtGui/QPointingDevice>
9#include <QtGui/QScreen>
10#include <QtGui/QPointingDevice>
11#include <QtGui/private/qhighdpiscaling_p.h>
12#include <QtGui/private/qpointingdevice_p.h>
21 const int id =
qMax(0, slot);
23 for (
int i = 0;
i < m_points.size(); ++
i)
24 if (m_points.at(
i).id ==
id)
30QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *
e)
32 libinput_device *dev = libinput_event_get_device(libinput_event_touch_get_base_event(
e));
33 return &m_devState[dev];
36QRect QLibInputTouch::screenGeometry(DeviceState *
state)
39 if (!
state->m_screenName.isEmpty()) {
43 if (
s->name() ==
state->m_screenName) {
55QPointF QLibInputTouch::getPos(libinput_event_touch *
e)
59 const double x = libinput_event_touch_get_x_transformed(
e, geom.
width());
60 const double y = libinput_event_touch_get_y_transformed(
e, geom.
height());
66 struct udev_device *udev_device;
67 udev_device = libinput_device_get_udev_device(dev);
71 qCDebug(qLcLibInput,
"libinput: registerDevice %s - %s",
77 m_devState[dev].m_screenName =
mapping->screenNameForDeviceNode(devNode);
78 if (!m_devState[dev].m_screenName.
isEmpty()) {
79 geom = screenGeometry(&m_devState[dev]);
80 qCDebug(qLcLibInput) <<
"libinput: Mapping device" << devNode
81 <<
"to screen" << m_devState[dev].m_screenName
82 <<
"with geometry" << geom;
93 devPriv->setAvailableVirtualGeometry(geom);
105 int slot = libinput_event_touch_get_slot(
e);
106 DeviceState *
state = deviceState(
e);
116 state->m_points.append(newTp);
117 qCDebug(qLcLibInputEvents) <<
"touch down" << newTp;
123 int slot = libinput_event_touch_get_slot(
e);
124 DeviceState *
state = deviceState(
e);
136 tp->
state = tmpState;
137 qCDebug(qLcLibInputEvents) <<
"touch move" << tp;
139 qWarning(
"Inconsistent touch state (got 'motion' without 'down')");
145 int slot = libinput_event_touch_get_slot(
e);
146 DeviceState *
state = deviceState(
e);
151 QEventPoint::States
s;
152 for (
int i = 0;
i <
state->m_points.size(); ++
i)
153 s |=
state->m_points.at(
i).state;
154 qCDebug(qLcLibInputEvents) <<
"touch up" <<
s << tp;
158 qCDebug(qLcLibInputEvents,
"waiting for all points to be released");
160 qWarning(
"Inconsistent touch state (got 'up' without 'down')");
166 DeviceState *
state = deviceState(
e);
167 qCDebug(qLcLibInputEvents) <<
"touch cancel" <<
state->m_points;
168 if (
state->m_touchDevice)
171 qWarning(
"TouchCancel without registered device");
176 DeviceState *
state = deviceState(
e);
177 if (!
state->m_touchDevice) {
178 qWarning(
"TouchFrame without registered device");
181 qCDebug(qLcLibInputEvents) <<
"touch frame" <<
state->m_points;
182 if (
state->m_points.isEmpty())
188 for (
int i = 0;
i <
state->m_points.size(); ++
i) {
191 state->m_points.removeAt(
i--);
State
Specifies the state of this event point.
QScreen * primaryScreen
the primary (or default) screen of the application.
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
static QList< QScreen * > screens()
Returns a list of all the screens associated with the windowing system the application is connected t...
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
static QOutputMapping * get()
\inmodule QtCore\reentrant
static QPointingDevicePrivate * get(QPointingDevice *q)
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
constexpr void moveCenter(const QPointF &p) noexcept
Moves the rectangle, leaving the center point at the given position.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
The QScreen class is used to query screen properties. \inmodule QtGui.
QRect geometry
the screen's geometry in pixels
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QWindowSystemInterface provides an event queue for the QPA platform.
static bool handleTouchEvent(QWindow *window, const QPointingDevice *device, const QList< struct TouchPoint > &points, Qt::KeyboardModifiers mods=Qt::NoModifier)
static bool handleTouchCancelEvent(QWindow *window, const QPointingDevice *device, Qt::KeyboardModifiers mods=Qt::NoModifier)
static void registerInputDevice(const QInputDevice *device)
T toNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLenum GLenum GLenum GLenum mapping
#define qPrintable(string)