diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-01-16 09:39:29 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-01-16 08:47:40 +0100 |
commit | 8c87d2004f6264f2a6596f565e6b1005f7550e76 (patch) | |
tree | 7e1baaacc57b0183fe38beedf58f6c2d5128c8a8 /src/compositor/wayland_wrapper | |
parent | 56272ebc3b796cf4da729057c8c3f051497ebf43 (diff) |
Avoid using an extra event for each touch report.
Instead of using touch_frame the number of non-stationary points (that
is, the number of touch events sent) is included in the touch events
themselves.
Change-Id: Ied29f05d7e00676d47ee0b91006cafb4569951c4
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r-- | src/compositor/wayland_wrapper/wltouch.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compositor/wayland_wrapper/wltouch.cpp b/src/compositor/wayland_wrapper/wltouch.cpp index 76b15fbeb..fe6ada264 100644 --- a/src/compositor/wayland_wrapper/wltouch.cpp +++ b/src/compositor/wayland_wrapper/wltouch.cpp @@ -110,6 +110,15 @@ void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface) if (target->client != surfaceClient) continue; + // We will use no touch_frame type of event, to reduce the number of + // events flowing through the wire. Instead, the number of points sent is + // included in the touch point events. + int sentPointCount = 0; + for (int i = 0; i < pointCount; ++i) { + if (points.at(i).state() != Qt::TouchPointStationary) + ++sentPointCount; + } + for (int i = 0; i < pointCount; ++i) { const QTouchEvent::TouchPoint &tp(points.at(i)); // Stationary points are never sent. They are cached on client side. @@ -117,7 +126,7 @@ void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface) continue; uint32_t id = tp.id(); - uint32_t state = tp.state(); + uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16); uint32_t flags = tp.flags(); QPointF p = tp.pos() - surfacePos; // surface-relative @@ -155,8 +164,6 @@ void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface) pressure, vx, vy, flags, rawData); } - - wl_resource_post_event(target, WL_TOUCH_EXTENSION_TOUCH_FRAME); } } |