10#include <QLoggingCategory>
12#include <QCoreApplication>
14#include <private/qdebug_p.h>
190#if QT_DEPRECATED_SINCE(6, 0)
197void QPointingDevice::setType(DeviceType devType)
200 d->deviceType = devType;
226void QPointingDevice::setCapabilities(QInputDevice::Capabilities caps)
229 d->capabilities = caps;
236void QPointingDevice::setMaximumTouchPoints(
int c)
239 d->maximumTouchPoints =
c;
249 return d->pointerType;
259 return d->maximumTouchPoints;
268 return d->buttonCount;
305 if (!mouse->
parent() || !qobject_cast<const QInputDevice *>(mouse->
parent()))
308 if (!touchpad || !dev->
parent() || dev->
parent()->metaObject() != dev->metaObject())
312 if (!mouse && !touchpad) {
313 qCDebug(lcQpaInputDevices) <<
"no mouse-like devices registered for seat" <<
seatName
314 <<
"The platform plugin should have provided one via "
315 "QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now.";
323 qCDebug(lcQpaInputDevices) <<
"core pointer ambiguous for seat" <<
seatName;
351 QPointingDevice::Capabilities capabilities,
360 bool uniqueIdDiscovered = (devPriv->uniqueId.numericId() == 0 &&
uniqueId.
numericId() != 0);
363 (devPriv->uniqueId ==
uniqueId || uniqueIdDiscovered)) {
364 if (uniqueIdDiscovered) {
368 qCDebug(lcQpaInputDevices) <<
"discovered unique ID and capabilities of tablet tool" << pdev;
409 if (epd.exclusiveGrabber)
414 if (epd.exclusiveGrabber)
443 auto &epd =
it.value();
444 QMutableEventPoint::setId(epd.eventPoint,
id);
445 QMutableEventPoint::setDevice(epd.eventPoint,
q);
506 if (!persistentPoint) {
507 qWarning() <<
"point is not in activePoints" << point;
510 Q_ASSERT(persistentPoint->eventPoint.id() == point.
id());
511 if (persistentPoint->exclusiveGrabber == exclusiveGrabber)
513 auto oldGrabber = persistentPoint->exclusiveGrabber;
514 persistentPoint->exclusiveGrabber = exclusiveGrabber;
517 event, persistentPoint->eventPoint);
518 if (
Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
521 <<
": grab" << oldGrabber <<
"->" << exclusiveGrabber;
523 QMutableEventPoint::setGlobalGrabPosition(persistentPoint->eventPoint, point.
globalPosition());
524 if (exclusiveGrabber)
527 persistentPoint->exclusiveGrabberContext.clear();
538 if (pt.exclusiveGrabber == grabber) {
550 if (!persistentPoint) {
551 qWarning() <<
"point is not in activePoints" << point;
554 if (persistentPoint->passiveGrabbers.contains(grabber))
556 if (
Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
558 <<
": grab (passive)" << grabber;
560 persistentPoint->passiveGrabbers << grabber;
580 if (!persistentPoint) {
581 qWarning() <<
"point is not in activePoints" << point;
584 qsizetype i = persistentPoint->passiveGrabbers.indexOf(grabber);
586 if (
Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
588 <<
": removing passive grabber" << grabber;
591 persistentPoint->passiveGrabbers.removeAt(
i);
592 if (persistentPoint->passiveGrabbersContext.size()) {
593 Q_ASSERT(persistentPoint->passiveGrabbersContext.size() >
i);
594 persistentPoint->passiveGrabbersContext.removeAt(
i);
605 if (!persistentPoint) {
606 qWarning() <<
"point is not in activePoints" << point;
609 if (persistentPoint->passiveGrabbers.isEmpty())
611 if (
Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
613 <<
": clearing" << persistentPoint->passiveGrabbers;
615 for (
auto g : persistentPoint->passiveGrabbers)
617 persistentPoint->passiveGrabbers.clear();
618 persistentPoint->passiveGrabbersContext.clear();
636 auto &epd = ap.second;
637 if (epd.exclusiveGrabber.data() == grabber) {
638 qCDebug(lcPointerGrab) <<
name <<
"point" << epd.eventPoint.id() << epd.eventPoint.state()
639 <<
"@" << epd.eventPoint.scenePosition()
640 <<
": grab" << grabber <<
"-> nullptr";
641 epd.exclusiveGrabber.clear();
642 epd.exclusiveGrabberContext.clear();
643 emit q->grabChanged(grabber,
645 nullptr, epd.eventPoint);
647 qsizetype pi = epd.passiveGrabbers.indexOf(grabber);
649 qCDebug(lcPointerGrab) <<
name <<
"point" << epd.eventPoint.id() << epd.eventPoint.state()
650 <<
": removing passive grabber" << grabber;
651 epd.passiveGrabbers.removeAt(
pi);
652 if (epd.passiveGrabbersContext.size()) {
653 Q_ASSERT(epd.passiveGrabbersContext.size() >
pi);
654 epd.passiveGrabbersContext.removeAt(
pi);
656 emit q->grabChanged(grabber,
658 nullptr, epd.eventPoint);
679 qCDebug(lcQpaInputDevices) <<
"failed to find registered tablet device"
681 <<
"The platform plugin should have provided one via "
682 "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
701#ifndef QT_NO_DEBUG_STREAM
707 debug <<
"QPointingDevice(";
712 if (!
device->seatName().isEmpty())
715 debug <<
" ptrType=";
722 if (
device->maximumPoints() > 1)
724 if (
device->uniqueId().isValid())
823#include "moc_qpointingdevice.cpp"
IOBluetoothDevice * device
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
The QEventPoint class provides information about a point in a QPointerEvent.
QPointF globalPosition
the global position of this point.
int id
the ID number of this event point.
QPointF scenePosition
the scene position of this point.
State state
the current state of the event point.
bool isEmpty() const noexcept
iterator find(const Key &key)
bool remove(const Key &key)
const mapped_container_type & values() const noexcept
std::pair< iterator, bool > try_emplace(const Key &key, Args &&...args)
qsizetype size() const noexcept
bool isEmpty() const noexcept
void resize(qsizetype size)
static QObject * target(const QEventPoint &p)
static QWindow * window(const QEventPoint &p)
static QMutableTouchEvent * from(QTouchEvent *e)
void addPoint(const QEventPoint &point)
QObject * parent() const
Returns a pointer to the parent object.
A base class for pointer events.
void clearPassiveGrabbers(const QEventPoint &point)
Removes all passive grabbers from the given point.
void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber)
Informs the delivery logic that the given exclusiveGrabber is to receive all future update events and...
const QList< QEventPoint > & points() const
Returns a list of points in this pointer event.
QPointingDevice::PointerType pointerType
QObject * firstActiveTarget() const
void removeGrabber(QObject *grabber, bool cancel=false)
static bool setPassiveGrabberContext(EventPointData *epd, QObject *grabber, QObject *context)
~QPointingDevicePrivate() override
static const QPointingDevice * tabletDevice(QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QPointingDeviceUniqueId uniqueId)
EventPointMap activePoints
bool removePassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber)
static const QPointingDevice * queryTabletDevice(QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QPointingDeviceUniqueId uniqueId, QInputDevice::Capabilities capabilities=QInputDevice::Capability::None, qint64 systemId=0)
QWindow * firstActiveWindow() const
void clearPassiveGrabbers(const QPointerEvent *event, const QEventPoint &point)
void sendTouchCancelEvent(QTouchEvent *cancelEvent)
bool removeExclusiveGrabber(const QPointerEvent *event, const QObject *grabber)
bool addPassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber)
QPointingDeviceUniqueId uniqueId
EventPointData * queryPointById(int id) const
static const QPointingDevice * pointingDeviceById(qint64 systemId)
QObject * firstPointExclusiveGrabber() const
EventPointData * pointById(int id) const
static QPointingDevicePrivate * get(QPointingDevice *q)
void setExclusiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *exclusiveGrabber)
void removePointById(int id)
QPointingDeviceUniqueId identifies a unique object, such as a tagged token or stylus,...
qint64 numericId
the numeric unique ID of the token represented by a touchpoint
size_t qHash(QPointingDeviceUniqueId key, size_t seed) noexcept
static QPointingDeviceUniqueId fromNumericId(qint64 id)
Constructs a unique pointer ID from numeric ID id.
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
static const QPointingDevice * primaryPointingDevice(const QString &seatName=QString())
Returns the primary pointing device (the core pointer, traditionally assumed to be a mouse) on the gi...
bool operator==(const QPointingDevice &other) const
PointerType
This enum represents what is interacting with the pointing device.
QPointingDeviceUniqueId uniqueId
QPointingDevice(QObject *parent=nullptr)
Creates a new invalid pointing device instance as a child of parent.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isNull() const
Returns true if this string is null; otherwise returns false.
The QTouchEvent class contains parameters that describe a touch event.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static void formatQEnum(QDebug &debug, QEnum value)
static void formatQFlags(QDebug &debug, const QFlags< Enum > &value)
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLsizei const GLfloat * v
[13]
GLdouble GLdouble GLdouble GLdouble q
QDebug operator<<(QDebug debug, const QPointingDevice *device)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
static QInputDevice::DeviceType deviceType(const UINT cursorType)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
QList< QPointer< QObject > > passiveGrabbers
QList< QPointer< QObject > > passiveGrabbersContext
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent