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

Unified Diff: ui/aura/root_window.cc

Issue 10448102: Adds switch to disable generating mouse events from touch events and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove released and fix bug in GestureRecognizerImpl Created 8 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.h ('k') | ui/base/events.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window.cc
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index b47fc603aa5d79931699a0bfccfbdf49b5569bd9..2bcb174da94f1b82854fbbe250ad1068169b5a10 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -116,6 +116,7 @@ RootWindow::RootWindow(const gfx::Rect& initial_bounds)
ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)),
mouse_button_flags_(0),
+ touch_ids_down_(0),
last_cursor_(ui::kCursorNull),
cursor_shown_(true),
capture_window_(NULL),
@@ -308,6 +309,22 @@ bool RootWindow::DispatchScrollEvent(ScrollEvent* event) {
bool RootWindow::DispatchTouchEvent(TouchEvent* event) {
DispatchHeldMouseMove();
+ switch (event->type()) {
+ case ui::ET_TOUCH_PRESSED:
+ touch_ids_down_ |= (1 << event->touch_id());
+ Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
+ break;
+
+ // Don't handle ET_TOUCH_CANCELLED since we always get a ET_TOUCH_RELEASED.
+ case ui::ET_TOUCH_RELEASED:
+ touch_ids_down_ = (touch_ids_down_ | (1 << event->touch_id())) ^
+ (1 << event->touch_id());
+ Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
+ break;
+
+ default:
+ break;
+ }
float scale = ui::GetDeviceScaleFactor(layer());
ui::Transform transform = layer()->transform();
transform.ConcatScale(scale, scale);
@@ -743,7 +760,9 @@ ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target,
if (target->delegate())
status = target->delegate()->OnGestureEvent(event);
- if (status == ui::GESTURE_STATUS_UNKNOWN) {
+ if (status == ui::GESTURE_STATUS_UNKNOWN &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAuraDisableMouseEventsFromTouch)) {
// The gesture was unprocessed. Generate corresponding mouse events here
// (e.g. tap to click).
const ui::EventType* types = NULL;
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/base/events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698