From 5c92d21cce18eef9b57f42323b464b6670124c3a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 16 Jun 2014 14:09:38 +0200 Subject: xcb: QTabletEvents and proximity events correctly identify the tool The tool is enum TabletDevice reported in QTabletEvent::device(). Each type of tool for each type of tablet has an ID which needs to be mapped to this enum. The meaning of the AbsWheel valuator depends on the tool type: an airbrush sends tangentialPressure in the range -1..+1, whereas an Art Pen (RotationStylus) sends rotation in degrees. Because the evdev driver sends valuator changes individually, we have to store the current value in each TabletData::ValuatorClassInfo to ensure that each QTabletEvent has complete state information. [ChangeLog][Platform Specific Changes][X11 / XCB] QTabletEvents and proximity events correctly identify the tool in use; the meaning of certain valuators depends on the tool; and the valuators' current values are not lost between events Task-number: QTBUG-39666 Task-number: QTBUG-39573 Task-number: QTBUG-39570 Change-Id: I6be242ee57e2ad0848060e04f20c0dd08954a734 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/xcb/qxcbconnection.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbconnection.h') diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 0bfc2f8f76..60a4efff4e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -507,22 +507,25 @@ private: int m_xiOpCode, m_xiEventBase, m_xiErrorBase; #ifndef QT_NO_TABLETEVENT struct TabletData { - TabletData() : deviceId(0), down(false), serialId(0), inProximity(false) { } + TabletData() : deviceId(0), pointerType(QTabletEvent::UnknownPointer), + tool(QTabletEvent::Stylus), down(false), serialId(0), inProximity(false) { } int deviceId; QTabletEvent::PointerType pointerType; + QTabletEvent::TabletDevice tool; bool down; qint64 serialId; bool inProximity; struct ValuatorClassInfo { - ValuatorClassInfo() : minVal(0), maxVal(0) { } + ValuatorClassInfo() : minVal(0.), maxVal(0.), curVal(0.) { } double minVal; double maxVal; + double curVal; int number; }; QHash valuatorInfo; }; bool xi2HandleTabletEvent(void *event, TabletData *tabletData); - void xi2ReportTabletEvent(const TabletData &tabletData, void *event); + void xi2ReportTabletEvent(TabletData &tabletData, void *event); QVector m_tabletData; #endif struct ScrollingDevice { -- cgit v1.2.3