summaryrefslogtreecommitdiffstats
path: root/ui/base/events
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 21:58:43 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 21:58:43 +0000
commitf7dbc3f9ef3a4d9c1a1f08f180e031fd9181eb50 (patch)
tree49d9f700afc33b742735740b1a0fd47df4b27ce7 /ui/base/events
parent0d586af877d89aadf5c5896971a1b6c5a33b49ec (diff)
downloadchromium_src-f7dbc3f9ef3a4d9c1a1f08f180e031fd9181eb50.zip
chromium_src-f7dbc3f9ef3a4d9c1a1f08f180e031fd9181eb50.tar.gz
chromium_src-f7dbc3f9ef3a4d9c1a1f08f180e031fd9181eb50.tar.bz2
Cache touch event's valuators at per touch level
Currently we cache touch event's valuator at per device level. It means, if 2 fingers' valuators are updated together, these valuators are mixed, e.g. if one drags one finger with small touch radius, and another finger with big touch radius, we will see both fingers have mixed small & big radius. This CL changes valuator cache at per touch level. BUG=159672 TEST=follow the test instruction in the issue and make sure it works. Review URL: https://chromiumcodereview.appspot.com/19776012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/events')
-rw-r--r--ui/base/events/event.cc5
-rw-r--r--ui/base/events/event_utils.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc
index 4384d4a..0281310 100644
--- a/ui/base/events/event.cc
+++ b/ui/base/events/event.cc
@@ -491,6 +491,11 @@ TouchEvent::TouchEvent(EventType type,
}
TouchEvent::~TouchEvent() {
+ // In ctor TouchEvent(native_event) we call GetTouchId() which in X11
+ // platform setups the tracking_id to slot mapping. So in dtor here,
+ // if this touch event is a release event, we clear the mapping accordingly.
+ if (HasNativeEvent())
+ ClearTouchIdIfReleased(native_event());
}
void TouchEvent::Relocate(const gfx::Point& origin) {
diff --git a/ui/base/events/event_utils.h b/ui/base/events/event_utils.h
index aaa4a20..d57ced9 100644
--- a/ui/base/events/event_utils.h
+++ b/ui/base/events/event_utils.h
@@ -80,6 +80,9 @@ UI_EXPORT gfx::Vector2d GetMouseWheelOffset(
// Gets the touch id from a native event.
UI_EXPORT int GetTouchId(const base::NativeEvent& native_event);
+// Clear the touch id from bookkeeping if it is a release/cancel event.
+UI_EXPORT void ClearTouchIdIfReleased(const base::NativeEvent& native_event);
+
// Gets the radius along the X/Y axis from a native event. Default is 1.0.
UI_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event);
UI_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event);