summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-01-10 10:33:55 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-01-10 12:36:44 +0100
commitbecc850c22c3bc9e4a2a2fc7140cb0dc95bfd8df (patch)
tree16854b4b43c1725864db162339554556f7f84d58 /src/compositor
parent6c32ea510f7f75764c7039e6f117e9b6e43b4622 (diff)
Add a function to the compositor api to send full touch events
A simple sendTouchPointEvent(id, x, y, ...) type of function will not be sufficient in the future due to the amount of data in a touch event; therefore an additional sendFullTouchEvent is introduced. This function takes a QTouchEvent and posts a series of down, motion, up, frame events as needed. In the future it may be changed so that it maps to a protocol extension instead of the standard events. As an example qwindow-compositor is updated to use this new function. Change-Id: I39d3df1c6d4868364440f59789d01fc5b7b80dac Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/waylandsurface.cpp6
-rw-r--r--src/compositor/compositor_api/waylandsurface.h3
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp16
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.h4
4 files changed, 29 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/waylandsurface.cpp b/src/compositor/compositor_api/waylandsurface.cpp
index 061c1aa95..b0b53a785 100644
--- a/src/compositor/compositor_api/waylandsurface.cpp
+++ b/src/compositor/compositor_api/waylandsurface.cpp
@@ -232,6 +232,12 @@ void WaylandSurface::sendTouchCancelEvent()
d->surface->sendTouchCancelEvent();
}
+void WaylandSurface::sendFullTouchEvent(QTouchEvent *event)
+{
+ Q_D(WaylandSurface);
+ d->surface->sendFullTouchEvent(event);
+}
+
void WaylandSurface::frameFinished()
{
Q_D(WaylandSurface);
diff --git a/src/compositor/compositor_api/waylandsurface.h b/src/compositor/compositor_api/waylandsurface.h
index a902c8280..091e1b0ac 100644
--- a/src/compositor/compositor_api/waylandsurface.h
+++ b/src/compositor/compositor_api/waylandsurface.h
@@ -52,6 +52,7 @@
#include <QtGui/qopengl.h>
#endif
+class QTouchEvent;
class WaylandSurfacePrivate;
#ifdef QT_COMPOSITOR_QUICK
@@ -110,6 +111,8 @@ public:
void sendTouchFrameEvent();
void sendTouchCancelEvent();
+ void sendFullTouchEvent(QTouchEvent *event);
+
void sendOnScreenVisibilityChange(bool visible);
void frameFinished();
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index 86ae1e973..c63886861 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -49,6 +49,7 @@
#include "wlsubsurface.h"
#include <QtCore/QDebug>
+#include <QTouchEvent>
#include <wayland-server.h>
@@ -750,6 +751,21 @@ void Surface::sendTouchCancelEvent()
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);
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index 88bd15c26..e784c6cf5 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -59,6 +59,8 @@
#include <QtGui/qopengl.h>
#endif
+class QTouchEvent;
+
namespace Wayland {
class Compositor;
@@ -105,6 +107,8 @@ public:
void sendTouchFrameEvent();
void sendTouchCancelEvent();
+ void sendFullTouchEvent(QTouchEvent *event);
+
void sendFrameCallback();
void frameFinished();