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

Side by Side Diff: ui/events/event.cc

Issue 1068463003: A mouse event created from the same native event will be marked as repeated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified EventsXTest.ClickCount to account for the change. Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/event_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/event.h" 5 #include "ui/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/keysym.h> 9 #include <X11/keysym.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 if (event1.type() != ET_MOUSE_PRESSED || 351 if (event1.type() != ET_MOUSE_PRESSED ||
352 event2.type() != ET_MOUSE_PRESSED) 352 event2.type() != ET_MOUSE_PRESSED)
353 return false; 353 return false;
354 354
355 // Compare flags, but ignore EF_IS_DOUBLE_CLICK to allow triple clicks. 355 // Compare flags, but ignore EF_IS_DOUBLE_CLICK to allow triple clicks.
356 if ((event1.flags() & ~EF_IS_DOUBLE_CLICK) != 356 if ((event1.flags() & ~EF_IS_DOUBLE_CLICK) !=
357 (event2.flags() & ~EF_IS_DOUBLE_CLICK)) 357 (event2.flags() & ~EF_IS_DOUBLE_CLICK))
358 return false; 358 return false;
359 359
360 // The new event has been created from the same native event.
361 if (event1.time_stamp() == event2.time_stamp())
362 return false;
363
360 base::TimeDelta time_difference = event2.time_stamp() - event1.time_stamp(); 364 base::TimeDelta time_difference = event2.time_stamp() - event1.time_stamp();
361 365
362 if (time_difference.InMilliseconds() > kDoubleClickTimeMS) 366 if (time_difference.InMilliseconds() > kDoubleClickTimeMS)
363 return false; 367 return false;
364 368
365 if (std::abs(event2.x() - event1.x()) > kDoubleClickWidth / 2) 369 if (std::abs(event2.x() - event1.x()) > kDoubleClickWidth / 2)
366 return false; 370 return false;
367 371
368 if (std::abs(event2.y() - event1.y()) > kDoubleClickHeight / 2) 372 if (std::abs(event2.y() - event1.y()) > kDoubleClickHeight / 2)
369 return false; 373 return false;
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 gfx::PointF(x, y), 988 gfx::PointF(x, y),
985 time_stamp, 989 time_stamp,
986 flags | EF_FROM_TOUCH), 990 flags | EF_FROM_TOUCH),
987 details_(details) { 991 details_(details) {
988 } 992 }
989 993
990 GestureEvent::~GestureEvent() { 994 GestureEvent::~GestureEvent() {
991 } 995 }
992 996
993 } // namespace ui 997 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698