summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowstabletsupport.cpp
diff options
context:
space:
mode:
authorRomain Pokrzywka <romain.pokrzywka@bluescape.com>2015-09-17 13:33:46 -0700
committerRomain Pokrzywka <romain.pokrzywka@gmail.com>2015-11-26 00:51:03 +0000
commit8d6fe1a37193ace073971820a6a6b22379e3fa95 (patch)
treee4e9405f59dd2ba9a4c3ff24f867ac7bd9145413 /src/plugins/platforms/windows/qwindowstabletsupport.cpp
parent50cd0daf29d434b78cc70bbf732ee33b2bc18600 (diff)
Accept concurrent input from multiple tablet devices in QGuiApplication
As a follow-up to 352c357e6f0785c0775a85151d6716b47aea1006 enabling support for multiple evdevtablet plugins at runtime (one per device), we also need to adjust the way QGuiApplication handles the events received from those plugins, in particular when multiple devices are sending tablet events concurrently. Replace the static members in QGuiApplication by a vector storing the same data per-device, so tablet press/release events can be recognized independently. Change-Id: Ie0975cdb03a8f6d05903e2e2e57ceb9de73a74a4 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowstabletsupport.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index b27811df9e..d5aae9746d 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -391,6 +391,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
const int currentDevice = m_devices.at(m_currentDevice).currentDevice;
const int currentPointer = m_devices.at(m_currentDevice).currentPointerType;
+ const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId;
// The tablet can be used in 2 different modes, depending on it settings:
// 1) Absolute (pen) mode:
@@ -407,7 +408,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
const QRect virtualDesktopArea = QGuiApplication::primaryScreen()->virtualGeometry();
qCDebug(lcQpaTablet) << __FUNCTION__ << "processing " << packetCount
- << "target:" << QGuiApplicationPrivate::tabletPressTarget;
+ << "target:" << QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target;
const Qt::KeyboardModifiers keyboardModifiers = QWindowsKeyMapper::queryKeyboardModifiers();
@@ -420,7 +421,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
QPointF globalPosF = m_oldGlobalPosF;
m_oldGlobalPosF = m_devices.at(m_currentDevice).scaleCoordinates(packet.pkX, packet.pkY, virtualDesktopArea);
- QWindow *target = QGuiApplicationPrivate::tabletPressTarget; // Pass to window that grabbed it.
+ QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target; // Pass to window that grabbed it.
QPoint globalPos = globalPosF.toPoint();
// Get Mouse Position and compare to tablet info
@@ -484,7 +485,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
static_cast<Qt::MouseButtons>(packet.pkButtons),
pressureNew, tiltX, tiltY,
tangentialPressure, rotation, z,
- m_devices.at(m_currentDevice).uniqueId,
+ uniqueId,
keyboardModifiers);
}
return true;