summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandtouch.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-15 15:24:18 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-15 13:32:10 +0000
commit31e05941cafbb5169ae2d98fef3c61cc718cf818 (patch)
treee0a75912eac9d68b14f228a9a9c466cb0320e770 /src/compositor/compositor_api/qwaylandtouch.cpp
parent2123e8877e59c1ab35018366bb42cc4e76ac9a25 (diff)
Remove the touch grabber
Not tested. Change-Id: I247d57b06b87b38a649e10cf190db49e1d59566f Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandtouch.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp60
1 files changed, 16 insertions, 44 deletions
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp
index e417ab8ea..6903ca8c1 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -50,10 +50,7 @@ QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDe
: wl_touch()
, seat(seat)
, focusResource()
- , defaultGrab()
- , grab(&defaultGrab)
{
- grab->touch = touch;
}
void QWaylandTouchPrivate::resetFocusState()
@@ -74,45 +71,33 @@ void QWaylandTouchPrivate::touch_release(Resource *resource)
wl_resource_destroy(resource->handle);
}
-QWaylandTouchGrabber::QWaylandTouchGrabber()
+void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF &position)
{
-}
-
-QWaylandTouchGrabber::~QWaylandTouchGrabber()
-{
-}
-
-QWaylandDefaultTouchGrabber::QWaylandDefaultTouchGrabber()
- : QWaylandTouchGrabber()
-{
-}
-
-void QWaylandDefaultTouchGrabber::down(uint32_t time, int touch_id, const QPointF &position)
-{
- if (!touch->focusResource() || !touch->mouseFocus())
+ Q_Q(QWaylandTouch);
+ if (focusResource || q->mouseFocus())
return;
- uint32_t serial = touch->compositor()->nextSerial();
+ uint32_t serial = q->compositor()->nextSerial();
- wl_touch_send_down(touch->focusResource(), serial, time, touch->mouseFocus()->surfaceResource(), touch_id,
+ wl_touch_send_down(focusResource->handle, serial, time, q->mouseFocus()->surfaceResource(), touch_id,
wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
}
-void QWaylandDefaultTouchGrabber::up(uint32_t time, int touch_id)
+void QWaylandTouchPrivate::sendUp(uint32_t time, int touch_id)
{
- if (!touch->focusResource())
+ if (focusResource)
return;
- uint32_t serial = touch->compositor()->nextSerial();
+ uint32_t serial = compositor()->nextSerial();
- wl_touch_send_up(touch->focusResource(), serial, time, touch_id);
+ wl_touch_send_up(focusResource->handle, serial, time, touch_id);
}
-void QWaylandDefaultTouchGrabber::motion(uint32_t time, int touch_id, const QPointF &position)
+void QWaylandTouchPrivate::sendMotion(uint32_t time, int touch_id, const QPointF &position)
{
- if (!touch->focusResource())
+ if (!focusResource)
return;
- wl_touch_send_motion(touch->focusResource(), time, touch_id,
+ wl_touch_send_motion(focusResource->handle, time, touch_id,
wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
}
@@ -134,32 +119,19 @@ QWaylandCompositor *QWaylandTouch::compositor() const
return d->compositor();
}
-
-void QWaylandTouch::startGrab(QWaylandTouchGrabber *grab)
-{
- Q_D(QWaylandTouch);
- d->grab = grab;
- grab->touch = this;
-}
-
-void QWaylandTouch::endGrab()
-{
- Q_D(QWaylandTouch);
- d->grab = &d->defaultGrab;
-}
-
void QWaylandTouch::sendTouchPointEvent(int id, const QPointF &position, Qt::TouchPointState state)
{
Q_D(QWaylandTouch);
+ uint32_t time = compositor()->currentTimeMsecs();
switch (state) {
case Qt::TouchPointPressed:
- d->sendDown(id, position);
+ d->sendDown(time, id, position);
break;
case Qt::TouchPointMoved:
- d->sendMotion(id, position);
+ d->sendMotion(time, id, position);
break;
case Qt::TouchPointReleased:
- d->sendUp(id);
+ d->sendUp(time, id);
break;
case Qt::TouchPointStationary:
// stationary points are not sent through wayland, the client must cache them