Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: ui/base/x/events_x.cc

Issue 8839004: Release slotId of TouchEvent when USE_XI2_MT defined (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix style nit and add name to AUTHORS Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/events_x.cc
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc
index 59767293684217eb80346e35225ec65c75b3b887..4f2db853d7cb08892f4f8cb9a49e6dc114fc288a 100644
--- a/ui/base/x/events_x.cc
+++ b/ui/base/x/events_x.cc
@@ -359,10 +359,16 @@ int GetTouchId(const base::NativeEvent& xev) {
#if defined(USE_XI2_MT)
float tracking_id;
if (!factory->ExtractTouchParam(
- *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id))
+ *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id)) {
LOG(ERROR) << "Could not get the slot ID for the event. Using 0.";
- else
+ } else {
slot = factory->GetSlotForTrackingID(tracking_id);
+ ui::EventType type = ui::EventTypeFromNative(xev);
+ if (type == ui::ET_TOUCH_CANCELLED ||
+ type == ui::ET_TOUCH_RELEASED) {
+ factory->ReleaseSlotForTrackingID(tracking_id);
+ }
+ }
#else
if (!factory->ExtractTouchParam(
*xev, ui::TouchFactory::TP_SLOT_ID, &slot))
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698