Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Qt] Set all PlatformTouchPoint values possible from a QTouch event.
https://bugs.webkit.org/show_bug.cgi?id=77442

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-02-01
Reviewed by Kenneth Rohde Christiansen.

* platform/qt/PlatformTouchPointQt.cpp:
(WebCore::PlatformTouchPoint::PlatformTouchPoint):

Canonical link: https://commits.webkit.org/94424@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Allan Sandfeld Jensen authored and webkit-commit-queue committed Feb 1, 2012
1 parent 4a46424 commit 8d7ef2f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,13 @@
2012-02-01 Allan Sandfeld Jensen <allan.jensen@nokia.com>

[Qt] Set all PlatformTouchPoint values possible from a QTouch event.
https://bugs.webkit.org/show_bug.cgi?id=77442

Reviewed by Kenneth Rohde Christiansen.

* platform/qt/PlatformTouchPointQt.cpp:
(WebCore::PlatformTouchPoint::PlatformTouchPoint):

2012-02-01 Peter Rybin <peter.rybin@gmail.com>

Web Inspector: CodeGeneratorInspector.py: move type builder code to dedicated InspectorTypeBuilder .h/.cpp
Expand Down
22 changes: 17 additions & 5 deletions Source/WebCore/platform/qt/PlatformTouchPointQt.cpp
@@ -1,7 +1,7 @@
/*
* This file is part of the WebKit project.
*
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2009,2012 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
Expand All @@ -28,17 +28,29 @@
namespace WebCore {

PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point)
{
// The QTouchEvent::TouchPoint API states that ids will be >= 0.
m_id = static_cast<unsigned>(point.id());
: m_id(point.id())
, m_screenPos(point.screenPos().toPoint())
, m_pos(point.pos().toPoint())
{
switch (point.state()) {
case Qt::TouchPointReleased: m_state = TouchReleased; break;
case Qt::TouchPointMoved: m_state = TouchMoved; break;
case Qt::TouchPointPressed: m_state = TouchPressed; break;
case Qt::TouchPointStationary: m_state = TouchStationary; break;
}
m_screenPos = point.screenPos().toPoint();
m_pos = point.pos().toPoint();
// Qt reports touch point size as rectangles, but we will pretend it is an oval.
QRect touchRect = point.rect().toAlignedRect();
if (touchRect.isValid()) {
m_radiusX = point.rect().width() / 2;
m_radiusY = point.rect().height() / 2;
} else {
// http://www.w3.org/TR/2011/WD-touch-events-20110505: 1 if no value is known.
m_radiusX = 1;
m_radiusY = 1;
}
m_force = point.pressure();
// FIXME: Support m_rotationAngle if QTouchEvent at some point supports it.
}

}
Expand Down

0 comments on commit 8d7ef2f

Please sign in to comment.