From: Laszlo Agocs Date: Wed, 11 Jan 2012 14:18:21 +0000 (+0200) Subject: Make touch events working in the qml example compositor. X-Git-Tag: qt-v5.0.0-alpha1~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=411124b1abee95b8ff9a6c4c4f4d187b775b53fe;hp=86cb4cbcfc375d4e9c764694c02eb82c3c7aa64b;p=profile%2Fivi%2Fqtwayland.git Make touch events working in the qml example compositor. Change-Id: I03318359d13caf7287671bcc9e01da91acb928dd Sanity-Review: Qt Sanity Bot Reviewed-by: Jørgen Lind --- diff --git a/src/compositor/compositor_api/waylandsurfaceitem.cpp b/src/compositor/compositor_api/waylandsurfaceitem.cpp index 8d34232..9ecd79e 100644 --- a/src/compositor/compositor_api/waylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/waylandsurfaceitem.cpp @@ -106,6 +106,7 @@ void WaylandSurfaceItem::init(WaylandSurface *surface) setSmooth(true); setFlag(ItemHasContents); setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); + setAcceptHoverEvents(true); connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped())); connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped())); connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *))); @@ -189,15 +190,14 @@ void WaylandSurfaceItem::touchEvent(QTouchEvent *event) if (m_touchEventsEnabled && m_surface) { WaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice(); event->accept(); - QList points = event->touchPoints(); - if (!points.isEmpty()) { - for (int i = 0; i < points.count(); ++i) { - const QTouchEvent::TouchPoint &point(points.at(i)); - // Wayland expects surface-relative coordinates. - inputDevice->sendTouchPointEvent(point.id(), point.pos().x(), point.pos().y(), point.state()); - } - inputDevice->sendTouchFrameEvent(); + if (inputDevice->mouseFocus() != m_surface) { + QPoint pointPos; + QList points = event->touchPoints(); + if (!points.isEmpty()) + pointPos = points.at(0).pos().toPoint(); + inputDevice->setMouseFocus(m_surface, pointPos, pointPos); } + inputDevice->sendFullTouchEvent(event); } else { event->ignore(); }