Skip to content

Commit

Permalink
[qtzmozembed] Temporarily disable touch handling. JB#49613
Browse files Browse the repository at this point in the history
The InputData header will be replaced with a simpler wrapper
provided by the embedlite.
  • Loading branch information
rainemak authored and abranson committed May 11, 2020
1 parent 12e9bbd commit c961388
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/qmozview_p.cpp
Expand Up @@ -15,7 +15,10 @@
#include <QJsonParseError>
#include <QTouchEvent>

#if defined(HAS_INPUT)
#include <InputData.h>
#endif

#include <mozilla/embedlite/EmbedLiteApp.h>
#include <mozilla/gfx/Tools.h>
#include <sys/time.h>
Expand Down Expand Up @@ -1038,6 +1041,7 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)

// Add active touch point to cancelled touch sequence.
if (event->type() == QEvent::TouchCancel && touchPointsCount == 0) {
#if defined(HAS_INPUT)
QMapIterator<int, QPointF> i(mActiveTouchPoints);
MultiTouchInput multiTouchInputEnd(MultiTouchInput::MULTITOUCH_END, timeStamp, TimeStamp(), 0);
while (i.hasNext()) {
Expand All @@ -1054,6 +1058,7 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)
ReceiveInputEvent(multiTouchInputEnd);
// touch was canceled hence no need to generate touchstart or touchmove
return;
#endif
}

QList<int> pressedIds, moveIds, endIds;
Expand Down Expand Up @@ -1090,6 +1095,7 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)

// Produce separate event for every pressed touch points
Q_FOREACH (int id, pressedIds) {
#if defined(HAS_INPUT)
MultiTouchInput multiTouchInputStart(MultiTouchInput::MULTITOUCH_START, timeStamp, TimeStamp(), 0);
startIds.append(id);
std::sort(startIds.begin(), startIds.end(), std::less<int>());
Expand All @@ -1103,9 +1109,11 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)
}

ReceiveInputEvent(multiTouchInputStart);
#endif
}

Q_FOREACH (int id, endIds) {
#if defined(HAS_INPUT)
const QTouchEvent::TouchPoint &pt = event->touchPoints().at(idHash.value(id));
MultiTouchInput multiTouchInputEnd(MultiTouchInput::MULTITOUCH_END, timeStamp, TimeStamp(), 0);
multiTouchInputEnd.mTouches.AppendElement(SingleTouchData(pt.id(),
Expand All @@ -1114,9 +1122,11 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)
180.0f,
pt.pressure()));
ReceiveInputEvent(multiTouchInputEnd);
#endif
}

if (!moveIds.empty()) {
#if defined(HAS_INPUT)
if (!pressedIds.empty()) {
moveIds.append(pressedIds);
}
Expand All @@ -1134,18 +1144,24 @@ void QMozViewPrivate::touchEvent(QTouchEvent *event)
pt.pressure()));
}
ReceiveInputEvent(multiTouchInputMove);
#endif
}
}

#if defined(HAS_INPUT)

void QMozViewPrivate::ReceiveInputEvent(const InputData &event)
{
if (mViewInitialized) {
mView->ReceiveInputEvent(event);
}
}

#endif

void QMozViewPrivate::synthTouchBegin(const QVariant &touches)
{
#if defined(HAS_INPUT)
QList<QVariant> list = touches.toList();
MultiTouchInput meventStart(MultiTouchInput::MULTITOUCH_START,
QDateTime::currentMSecsSinceEpoch(), TimeStamp(), 0);
Expand All @@ -1160,10 +1176,12 @@ void QMozViewPrivate::synthTouchBegin(const QVariant &touches)
1.0f));
}
mView->ReceiveInputEvent(meventStart);
#endif
}

void QMozViewPrivate::synthTouchMove(const QVariant &touches)
{
#if defined(HAS_INPUT)
QList<QVariant> list = touches.toList();
MultiTouchInput meventStart(MultiTouchInput::MULTITOUCH_MOVE,
QDateTime::currentMSecsSinceEpoch(), TimeStamp(), 0);
Expand All @@ -1178,10 +1196,12 @@ void QMozViewPrivate::synthTouchMove(const QVariant &touches)
1.0f));
}
mView->ReceiveInputEvent(meventStart);
#endif
}

void QMozViewPrivate::synthTouchEnd(const QVariant &touches)
{
#if defined(HAS_INPUT)
QList<QVariant> list = touches.toList();
MultiTouchInput meventStart(MultiTouchInput::MULTITOUCH_END,
QDateTime::currentMSecsSinceEpoch(), TimeStamp(), 0);
Expand All @@ -1196,10 +1216,12 @@ void QMozViewPrivate::synthTouchEnd(const QVariant &touches)
1.0f));
}
mView->ReceiveInputEvent(meventStart);
#endif
}

void QMozViewPrivate::recvMouseMove(int posX, int posY)
{
#if defined(HAS_INPUT)
if (mViewInitialized && !mPendingTouchEvent) {
MultiTouchInput event(MultiTouchInput::MULTITOUCH_MOVE,
QDateTime::currentMSecsSinceEpoch(), TimeStamp(), 0);
Expand All @@ -1210,10 +1232,12 @@ void QMozViewPrivate::recvMouseMove(int posX, int posY)
1.0f));
ReceiveInputEvent(event);
}
#endif
}

void QMozViewPrivate::recvMousePress(int posX, int posY)
{
#if defined(HAS_INPUT)
mViewIface->forceViewActiveFocus();
if (mViewInitialized && !mPendingTouchEvent) {
MultiTouchInput event(MultiTouchInput::MULTITOUCH_START,
Expand All @@ -1225,10 +1249,12 @@ void QMozViewPrivate::recvMousePress(int posX, int posY)
1.0f));
ReceiveInputEvent(event);
}
#endif
}

void QMozViewPrivate::recvMouseRelease(int posX, int posY)
{
#if defined(HAS_INPUT)
if (mViewInitialized && !mPendingTouchEvent) {
MultiTouchInput event(MultiTouchInput::MULTITOUCH_END,
QDateTime::currentMSecsSinceEpoch(), TimeStamp(), 0);
Expand All @@ -1242,4 +1268,5 @@ void QMozViewPrivate::recvMouseRelease(int posX, int posY)
if (mPendingTouchEvent) {
mPendingTouchEvent = false;
}
#endif
}
1 change: 0 additions & 1 deletion src/quickmozview.cpp
Expand Up @@ -12,7 +12,6 @@
#include "mozilla-config.h"
#include "qmozcontext.h"
#include "qmozembedlog.h"
#include "InputData.h"
#include "mozilla/embedlite/EmbedLiteView.h"
#include "mozilla/embedlite/EmbedLiteApp.h"
#include "mozilla/TimeStamp.h"
Expand Down

0 comments on commit c961388

Please sign in to comment.