diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-06-05 06:33:05 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-07-28 16:37:44 +0200 |
commit | 6ad66140b1e63fa6e21c7f33d845a472c4390823 (patch) | |
tree | e073a5da8929a6df6ab4a184960c78dc57dea4e1 /src/gui/kernel/qwindowsysteminterface.cpp | |
parent | 67410cd644b76354ba17e9541903cdefa84fc85c (diff) |
add buttons to QTabletEvent
Until now, it has been necessary for tablet-oriented applications which
care about multi-button styli to reject each tablet event and wait for
the mouse event in order to know which buttons are pressed. This patch
adds the new API and also the X11/xcb implementation.
[ChangeLog][QtCore][Tablet support] Added buttons to QTabletEvent
Task-number: QTBUG-39458
Change-Id: If2c9ec1ceacc1700a82686c5fc6f568f9111055a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index c9990b0f4f..b716e84a42 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -629,24 +629,42 @@ void QWindowSystemInterface::handleFileOpenEvent(const QUrl &url) QGuiApplicationPrivate::processWindowSystemEvent(&e); } -void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, +void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, const QPointF &local, const QPointF &global, + int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers modifiers) { QWindowSystemInterfacePrivate::TabletEvent *e = - new QWindowSystemInterfacePrivate::TabletEvent(w, timestamp, down, local, global, device, pointerType, pressure, + new QWindowSystemInterfacePrivate::TabletEvent(w, timestamp, local, global, device, pointerType, buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } +void QWindowSystemInterface::handleTabletEvent(QWindow *w, const QPointF &local, const QPointF &global, + int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers) +{ + ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleTabletEvent(w, time, local, global, device, pointerType, buttons, pressure, + xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); +} + +void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers) +{ + handleTabletEvent(w, timestamp, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure, + xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); +} + void QWindowSystemInterface::handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers modifiers) { - ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleTabletEvent(w, time, down, local, global, device, pointerType, pressure, + handleTabletEvent(w, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure, xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); } |