summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-02-26 15:02:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-27 13:28:23 +0100
commitcebdd91f8bbebf43fd2ec3c4dd2f49f46172d47e (patch)
tree3f5a2401b2fabdfcaa7a7c9c2b09055bb35bdc8f /src/plugins/platforms
parentbbc4cc4a47bb96c8cb85b6f0dd607020e74f3e2c (diff)
Windows: Add platform plugin parameter for tablet absolute range.
Make the range for detecting relative (mouse mode) configureable using -platform windows:tabletabsoluterange=50 Task-number: QTBUG-36937 Change-Id: I44f928e53cb41b246c44554ec7f71bfbdf03c147 Reviewed-by: Arthur Krebsbach <Arthur.Krebsbach@Wacom.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h4
5 files changed, 28 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 08f3ab4dbd..f67fb9bc19 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -341,6 +341,16 @@ QWindowsContext::~QWindowsContext()
m_instance = 0;
}
+void QWindowsContext::setTabletAbsoluteRange(int a)
+{
+#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+ if (!d->m_tabletSupport.isNull())
+ d->m_tabletSupport->setAbsoluteRange(a);
+#else
+ Q_UNUSED(a)
+#endif
+}
+
QWindowsContext *QWindowsContext::instance()
{
return m_instance;
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 1fea059ed9..f5dbd072c7 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -183,6 +183,8 @@ public:
void setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx);
+ void setTabletAbsoluteRange(int a);
+
// Returns a combination of SystemInfoFlags
unsigned systemInfo() const;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index e5d9444966..3735865845 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -143,7 +143,7 @@ struct QWindowsIntegrationPrivate
explicit QWindowsIntegrationPrivate(const QStringList &paramList);
~QWindowsIntegrationPrivate();
- const unsigned m_options;
+ unsigned m_options;
QWindowsContext m_context;
QPlatformFontDatabase *m_fontDatabase;
#ifndef QT_NO_CLIPBOARD
@@ -165,7 +165,8 @@ struct QWindowsIntegrationPrivate
QWindowsServices m_services;
};
-static inline unsigned parseOptions(const QStringList &paramList)
+static inline unsigned parseOptions(const QStringList &paramList,
+ int *tabletAbsoluteRange)
{
unsigned options = 0;
foreach (const QString &param, paramList) {
@@ -187,15 +188,21 @@ static inline unsigned parseOptions(const QStringList &paramList)
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (param.startsWith(QLatin1String("verbose="))) {
QWindowsContext::verbose = param.right(param.size() - 8).toInt();
+ } else if (param.startsWith(QLatin1String("tabletabsoluterange="))) {
+ *tabletAbsoluteRange = param.rightRef(param.size() - 20).toInt();
}
}
return options;
}
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
- : m_options(parseOptions(paramList))
+ : m_options(0)
, m_fontDatabase(0)
{
+ int tabletAbsoluteRange = -1;
+ m_options = parseOptions(paramList, &tabletAbsoluteRange);
+ if (tabletAbsoluteRange >= 0)
+ m_context.setTabletAbsoluteRange(tabletAbsoluteRange);
}
QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 8b863ec43d..484ed9cb05 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -159,6 +159,7 @@ bool QWindowsWinTab32DLL::init()
QWindowsTabletSupport::QWindowsTabletSupport(HWND window, HCTX context)
: m_window(window)
, m_context(context)
+ , m_absoluteRange(20)
, m_tiltSupport(false)
, m_currentDevice(-1)
{
@@ -402,7 +403,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
// in which case we snap the position to the mouse position.
// It seems there is no way to find out the mode programmatically, the LOGCONTEXT orgX/Y/Ext
// area is always the virtual desktop.
- enum { absoluteRange = 20 };
const QRect virtualDesktopArea = QGuiApplication::primaryScreen()->virtualGeometry();
qCDebug(lcQpaTablet) << __FUNCTION__ << "processing " << packetCount
@@ -427,7 +427,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
// Positions should be almost the same if we are in absolute
// mode. If they are not, use the mouse location.
- if ((mouseLocation - globalPos).manhattanLength() > absoluteRange) {
+ if ((mouseLocation - globalPos).manhattanLength() > m_absoluteRange) {
globalPos = mouseLocation;
globalPosF = globalPos;
}
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 5e29cd9554..527d9dbf37 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -124,6 +124,9 @@ public:
bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam);
bool translateTabletPacketEvent();
+ int absoluteRange() const { return m_absoluteRange; }
+ void setAbsoluteRange(int a) { m_absoluteRange = a; }
+
private:
unsigned options() const;
QWindowsTabletDeviceData tabletInit(const quint64 uniqueId, const UINT cursorType) const;
@@ -131,6 +134,7 @@ private:
static QWindowsWinTab32DLL m_winTab32DLL;
const HWND m_window;
const HCTX m_context;
+ int m_absoluteRange;
bool m_tiltSupport;
QVector<QWindowsTabletDeviceData> m_devices;
int m_currentDevice;