7#include <QSocketNotifier>
10#include <QGuiApplication>
11#include <qpa/qwindowsysteminterface.h>
12#include <private/qguiapplication_p.h>
13#include <private/qinputdevicemanager_p_p.h>
15#include <private/qcore_unix_p.h>
51 if (ioctl(m_devFd, MOUSE_GETLEVEL, &
level)) {
66 qWarning(
"Unsupported mouse device operation level: %d",
level);
72 if (fcntl(m_devFd, F_SETFL, O_NONBLOCK)) {
91void QBsdMouseHandler::readMouseData()
96 if (m_packetSize == 0)
100 qint8 packet[MOUSE_SYS_PACKETSIZE];
102 while (
read(m_devFd, packet, m_packetSize) == m_packetSize) {
103 const qint16 relx = packet[1] + packet[3];
104 const qint16 rely = -(packet[2] + packet[4]);
109 status = packet[0] & MOUSE_SYS_STDBUTTONS;
114 if (m_x + m_xOffset <
g.left())
115 m_x =
g.left() - m_xOffset;
116 else if (m_x + m_xOffset >
g.right())
117 m_x =
g.right() - m_xOffset;
119 if (m_y + m_yOffset <
g.top())
120 m_y =
g.top() - m_yOffset;
121 else if (m_y + m_yOffset >
g.bottom())
122 m_y =
g.bottom() - m_yOffset;
124 const QPoint pos(m_x + m_xOffset, m_y + m_yOffset);
126 if (!(status & MOUSE_SYS_BUTTON1UP))
128 if (!(status & MOUSE_SYS_BUTTON2UP))
130 if (!(status & MOUSE_SYS_BUTTON3UP))
IOBluetoothDevice * device
~QBsdMouseHandler() override
QBsdMouseHandler(const QString &key, const QString &specification)
static QByteArray encodeName(const QString &fileName)
Converts fileName to an 8-bit encoding that you can use in native APIs.
static QInputDeviceManager * inputDeviceManager()
QScreen * primaryScreen
the primary (or default) screen of the application.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
QRect virtualGeometry
the pixel geometry of the virtual desktop to which this screen belongs
void activated(QSocketDescriptor socket, QSocketNotifier::Type activationEvent, QPrivateSignal)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
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)
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
GLenum GLuint GLint level
QLatin1StringView QLatin1String
QT_BEGIN_NAMESPACE typedef signed char qint8
ReturnedValue read(const char *data)