diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 78e33e57ab..dcad23e446 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -111,6 +111,61 @@ inline QPointF QWindowsTabletDeviceData::scaleCoordinates(int coordX, int coordY return QPointF(x, y); } +template +static void formatOptions(Stream &str, unsigned options) +{ + if (options & CXO_SYSTEM) + str << " CXO_SYSTEM"; + if (options & CXO_PEN) + str << " CXO_PEN"; + if (options & CXO_MESSAGES) + str << " CXO_MESSAGES"; + if (options & CXO_MARGIN) + str << " CXO_MARGIN"; + if (options & CXO_MGNINSIDE) + str << " CXO_MGNINSIDE"; + if (options & CXO_CSRMESSAGES) + str << " CXO_CSRMESSAGES"; +} + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure + << ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".." + << t.maxTanPressure << " area:" << t.minX << t.minY <" << TabletPacketQSize; + << "->" << TabletPacketQSize << "\nobtained: " << lcMine; return new QWindowsTabletSupport(window, context); } @@ -238,17 +295,23 @@ QString QWindowsTabletSupport::description() const WORD specificationVersion = 0; m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_SPECVERSION, &specificationVersion); const unsigned opts = options(); - QString result = QString::fromLatin1("%1 specification: v%2.%3 implementation: v%4.%5 options: 0x%6") - .arg(QString::fromWCharArray(winTabId.data())) - .arg(specificationVersion >> 8).arg(specificationVersion & 0xFF) - .arg(implementationVersion >> 8).arg(implementationVersion & 0xFF) - .arg(opts, 0, 16); - if (opts & CXO_MESSAGES) - result += QLatin1String(" CXO_MESSAGES"); - if (opts & CXO_CSRMESSAGES) - result += QLatin1String(" CXO_CSRMESSAGES"); + WORD devices = 0; + m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_NDEVICES, &devices); + WORD cursors = 0; + m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_NCURSORS, &cursors); + WORD extensions = 0; + m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_NEXTENSIONS, &extensions); + QString result; + QTextStream str(&result); + str << '"' << QString::fromWCharArray(winTabId.data()) + << "\" specification: v" << (specificationVersion >> 8) + << '.' << (specificationVersion & 0xFF) << " implementation: v" + << (implementationVersion >> 8) << '.' << (implementationVersion & 0xFF) + << ' ' << devices << " device(s), " << cursors << " cursor(s), " + << extensions << " extensions" << ", options: 0x" << hex << opts << dec; + formatOptions(str, opts); if (m_tiltSupport) - result += QLatin1String(" tilt"); + str << " tilt"; return result; } @@ -306,20 +369,6 @@ static inline QTabletEvent::PointerType pointerType(unsigned currentCursor) return QTabletEvent::UnknownPointer; } -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure - << ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".." - << t.maxTanPressure << " area:" << t.minX << t.minY <