QList<QTouchEvent::TouchPoint> points = te->touchPoints();
for (int i = 0; i < points.count(); ++i) {
const QTouchEvent::TouchPoint &tp(points.at(i));
- QPoint local;
- WaylandSurface *targetSurface = surfaceAt(tp.pos().toPoint(), &local);
- if (targetSurface) {
- targetSurface->sendTouchPointEvent(tp.id(), local.x(), local.y(), tp.state());
+ WaylandSurface *targetSurface = surfaceAt(tp.pos().toPoint());
+ if (targetSurface)
targets.insert(targetSurface);
- }
}
foreach (WaylandSurface *surface, targets)
- surface->sendTouchFrameEvent();
+ surface->sendFullTouchEvent(te);
break;
}
default:
d->surface->sendTouchCancelEvent();
}
+void WaylandSurface::sendFullTouchEvent(QTouchEvent *event)
+{
+ Q_D(WaylandSurface);
+ d->surface->sendFullTouchEvent(event);
+}
+
void WaylandSurface::frameFinished()
{
Q_D(WaylandSurface);
#include <QtGui/qopengl.h>
#endif
+class QTouchEvent;
class WaylandSurfacePrivate;
#ifdef QT_COMPOSITOR_QUICK
void sendTouchFrameEvent();
void sendTouchCancelEvent();
+ void sendFullTouchEvent(QTouchEvent *event);
+
void sendOnScreenVisibilityChange(bool visible);
void frameFinished();
#include "wlsubsurface.h"
#include <QtCore/QDebug>
+#include <QTouchEvent>
#include <wayland-server.h>
WL_INPUT_DEVICE_TOUCH_CANCEL);
}
+void Surface::sendFullTouchEvent(QTouchEvent *event)
+{
+ const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
+ if (points.isEmpty())
+ return;
+ const int pointCount = points.count();
+ for (int i = 0; i < pointCount; ++i) {
+ const QTouchEvent::TouchPoint &tp(points.at(i));
+ // Convert the local pos in the compositor window to surface-relative.
+ QPoint p = (tp.pos() - pos()).toPoint();
+ sendTouchPointEvent(tp.id(), p.x(), p.y(), tp.state());
+ }
+ sendTouchFrameEvent();
+}
+
void Surface::sendFrameCallback()
{
Q_D(Surface);
#include <QtGui/qopengl.h>
#endif
+class QTouchEvent;
+
namespace Wayland {
class Compositor;
void sendTouchFrameEvent();
void sendTouchCancelEvent();
+ void sendFullTouchEvent(QTouchEvent *event);
+
void sendFrameCallback();
void frameFinished();