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

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

Issue 14582028: Do not coalesce X touch move events in aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 7 months 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 | « ui/aura/root_window_host_x11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index a4d9caa0f1623cb9c848c8d2db54f0d5550e19f5..ebd99b78a5c4aab5417c3354f93aa81d3a55ab6f 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -551,18 +551,11 @@ XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image,
int CoalescePendingMotionEvents(const XEvent* xev,
XEvent* last_event) {
XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data);
- int num_coalesed = 0;
+ int num_coalesced = 0;
Display* display = xev->xany.display;
int event_type = xev->xgeneric.evtype;
-#if defined(USE_XI2_MT)
- float tracking_id = -1;
- if (event_type == XI_TouchUpdate) {
- if (!ui::ValuatorTracker::GetInstance()->ExtractValuator(*xev,
- ui::ValuatorTracker::VAL_TRACKING_ID, &tracking_id))
- tracking_id = -1;
- }
-#endif
+ DCHECK_EQ(event_type, XI_Motion);
while (XPending(display)) {
XEvent next_event;
@@ -570,7 +563,7 @@ int CoalescePendingMotionEvents(const XEvent* xev,
// If we can't get the cookie, abort the check.
if (!XGetEventData(next_event.xgeneric.display, &next_event.xcookie))
- return num_coalesed;
+ return num_coalesced;
// If this isn't from a valid device, throw the event away, as
// that's what the message pump would do. Device events come in pairs
@@ -588,23 +581,10 @@ int CoalescePendingMotionEvents(const XEvent* xev,
!ui::GetFlingData(&next_event, NULL, NULL, NULL, NULL, NULL)) {
XIDeviceEvent* next_xievent =
static_cast<XIDeviceEvent*>(next_event.xcookie.data);
-#if defined(USE_XI2_MT)
- float next_tracking_id = -1;
- if (event_type == XI_TouchUpdate) {
- // If this is a touch motion event (as opposed to mouse motion event),
- // then make sure the events are from the same touch-point.
- if (!ui::ValuatorTracker::GetInstance()->ExtractValuator(next_event,
- ui::ValuatorTracker::VAL_TRACKING_ID, &next_tracking_id))
- next_tracking_id = -1;
- }
-#endif
// Confirm that the motion event is targeted at the same window
// and that no buttons or modifiers have changed.
if (xievent->event == next_xievent->event &&
xievent->child == next_xievent->child &&
-#if defined(USE_XI2_MT)
- (event_type == XI_Motion || tracking_id == next_tracking_id) &&
-#endif
xievent->buttons.mask_len == next_xievent->buttons.mask_len &&
(memcmp(xievent->buttons.mask,
next_xievent->buttons.mask,
@@ -615,12 +595,12 @@ int CoalescePendingMotionEvents(const XEvent* xev,
xievent->mods.effective == next_xievent->mods.effective) {
XFreeEventData(display, &next_event.xcookie);
// Free the previous cookie.
- if (num_coalesed > 0)
+ if (num_coalesced > 0)
XFreeEventData(display, &last_event->xcookie);
// Get the event and its cookie data.
XNextEvent(display, last_event);
XGetEventData(display, &last_event->xcookie);
- ++num_coalesed;
+ ++num_coalesced;
continue;
} else {
// This isn't an event we want so free its cookie data.
@@ -630,21 +610,13 @@ int CoalescePendingMotionEvents(const XEvent* xev,
break;
}
- if (num_coalesed > 0) {
+ if (num_coalesced > 0) {
base::TimeDelta delta = ui::EventTimeFromNative(last_event) -
ui::EventTimeFromNative(const_cast<XEvent*>(xev));
- if (event_type == XI_Motion) {
- UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Mouse", num_coalesed);
- UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Mouse", delta);
- } else {
-#if defined(USE_XI2_MT)
- DCHECK_EQ(event_type, XI_TouchUpdate);
-#endif
- UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Touch", num_coalesed);
- UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Touch", delta);
- }
+ UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Mouse", num_coalesced);
+ UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Mouse", delta);
}
- return num_coalesed;
+ return num_coalesced;
}
#endif
« no previous file with comments | « ui/aura/root_window_host_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698