Commit 1c6b2b42 authored by Sharaf Zaman's avatar Sharaf Zaman
Browse files

Add touch events to tablet debugger

parent 63333a2e
......@@ -600,6 +600,7 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
case QEvent::TouchBegin:
{
d->debugEvent<QTouchEvent, false>(event);
if (startTouch(retval)) {
QTouchEvent *touchEvent = static_cast<QTouchEvent *> (event);
KisAbstractInputAction::setInputManager(this);
......@@ -609,6 +610,7 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
{
d->previousPos = touchEvent->touchPoints().at(0).pos();
d->buttonPressed = false;
d->resetCompressor();
}
else {
retval = d->matcher.touchBeginEvent(touchEvent);
......@@ -625,6 +627,7 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
case QEvent::TouchUpdate:
{
QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);
d->debugEvent<QTouchEvent, false>(event);
#ifdef Q_OS_MAC
int count = 0;
......@@ -660,7 +663,6 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
d->touchStrokeStarted = true;
retval = compressMoveEventCommon(touchEvent);
d->blockMouseEvents();
d->resetCompressor();
}
else if (!d->touchStrokeStarted){
KisAbstractInputAction::setInputManager(this);
......@@ -681,6 +683,7 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
case QEvent::TouchEnd:
{
d->debugEvent<QTouchEvent, false>(event);
endTouch();
QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);
retval = d->matcher.touchEndEvent(touchEvent);
......@@ -701,6 +704,7 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
}
case QEvent::TouchCancel:
{
d->debugEvent<QTouchEvent, false>(event);
endTouch();
d->matcher.touchCancelEvent(d->previousPos);
// reset state
......
......@@ -81,6 +81,10 @@ QString KisTabletDebugger::exTypeToString(QEvent::Type type) {
type == QTabletEvent::TabletMove ? "TabletMove" :
type == QTabletEvent::TabletPress ? "TabletPress" :
type == QTabletEvent::TabletRelease ? "TabletRelease" :
type == QTouchEvent::TouchBegin ? "TouchBegin" :
type == QTouchEvent::TouchUpdate ? "TouchUpdate" :
type == QTouchEvent::TouchEnd ? "TouchEnd" :
type == QTouchEvent::TouchCancel ? "TouchCancel" :
"unknown";
}
......@@ -174,6 +178,24 @@ QString KisTabletDebugger::eventToString(const QWheelEvent &ev, const QString &p
return string;
}
QString KisTabletDebugger::eventToString(const QTouchEvent &ev, const QString &prefix)
{
QString string;
QTextStream s(&string);
dumpBaseParams(s, ev, prefix);
s << (ev.device()->type() ? "TouchPad" : "TouchScreen") << " ";
for (const auto& touchpoint: ev.touchPoints()) {
s << "id: " << touchpoint.id() << " ";
s << "hires: " << qSetFieldWidth(8) << touchpoint.screenPos().x() << qSetFieldWidth(0) << "," << qSetFieldWidth(8) << touchpoint.screenPos().y() << qSetFieldWidth(0) << " ";
s << "prs: " << touchpoint.pressure() << " ";
s << "rot: "<< touchpoint.rotation() << "; ";
}
return string;
}
QString KisTabletDebugger::eventToString(const QEvent &ev, const QString &prefix)
{
QString string;
......
......@@ -39,6 +39,7 @@ public:
QString eventToString(const QMouseEvent &ev, const QString &prefix);
QString eventToString(const QKeyEvent &ev, const QString &prefix);
QString eventToString(const QWheelEvent &ev, const QString &prefix);
QString eventToString(const QTouchEvent &ev, const QString &prefix);
QString eventToString(const QTabletEvent &ev, const QString &prefix);
QString eventToString(const QEvent &ev, const QString &prefix);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment