diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 20:38:42 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 20:38:42 +0000 |
commit | 4aeda5795fa3d1a3b3e5f7ed71c2acbc41d94a6d (patch) | |
tree | 45221c6258e7a1f8fe407645373f9a18b0e811f7 /ui/aura/root_window.cc | |
parent | d33f0067c151a55b38ebe687727ed2d3a34affee (diff) | |
download | chromium_src-4aeda5795fa3d1a3b3e5f7ed71c2acbc41d94a6d.zip chromium_src-4aeda5795fa3d1a3b3e5f7ed71c2acbc41d94a6d.tar.gz chromium_src-4aeda5795fa3d1a3b3e5f7ed71c2acbc41d94a6d.tar.bz2 |
aura: Add event queues in the GestureRecognizer.
Event-queues allow the GestureRecognizer to maintain multiple states for
different gestures. Especially, this makes it possible to correctly process
queued up (asynchronous) touch-events at the same time it processes synchronous
touch-events.
Throttling/filtering touch-events that go to the renderer is now removed. This
may be added back at a later time.
BUG=110230
TEST=none (will be added in a future CL: http://codereview.chromium.org/9129012/)
Review URL: https://chromiumcodereview.appspot.com/9150046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window.cc')
-rw-r--r-- | ui/aura/root_window.cc | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 573e8e93..304f738 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -227,19 +227,17 @@ bool RootWindow::DispatchTouchEvent(TouchEvent* event) { status == ui::TOUCH_STATUS_CANCEL) touch_event_handler_ = NULL; handled = status != ui::TOUCH_STATUS_UNKNOWN; + + if (status == ui::TOUCH_STATUS_QUEUED) + gesture_recognizer_->QueueTouchEventForGesture(target, *event); } // Get the list of GestureEvents from GestureRecognizer. scoped_ptr<GestureRecognizer::Gestures> gestures; gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture(*event, status)); - if (gestures.get()) { - for (unsigned int i = 0; i < gestures->size(); i++) { - GestureEvent* gesture = gestures->at(i).get(); - if (DispatchGestureEvent(gesture) != ui::GESTURE_STATUS_UNKNOWN) - handled = true; - } - } + if (ProcessGestures(gestures.get())) + handled = true; return handled; } @@ -298,6 +296,8 @@ void RootWindow::WindowDestroying(Window* window) { touch_event_handler_ = NULL; if (gesture_handler_ == window) gesture_handler_ = NULL; + + gesture_recognizer_->FlushTouchQueue(window); } #if !defined(OS_MACOSX) @@ -364,6 +364,16 @@ void RootWindow::ReleaseCapture(Window* window) { SetCapture(NULL); } +void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { + scoped_ptr<GestureRecognizer::Gestures> gestures; + gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); + ProcessGestures(gestures.get()); +} + +void RootWindow::SetGestureRecognizerForTesting(GestureRecognizer* gr) { + gesture_recognizer_.reset(gr); +} + void RootWindow::SetTransform(const ui::Transform& transform) { Window::SetTransform(transform); @@ -379,10 +389,6 @@ void RootWindow::ToggleFullScreen() { } #endif -void RootWindow::SetGestureRecognizerForTesting(GestureRecognizer* gr) { - gesture_recognizer_.reset(gr); -} - //////////////////////////////////////////////////////////////////////////////// // RootWindow, private: @@ -549,6 +555,18 @@ ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target, return status; } +bool RootWindow::ProcessGestures(GestureRecognizer::Gestures* gestures) { + if (!gestures) + return false; + bool handled = false; + for (unsigned int i = 0; i < gestures->size(); i++) { + GestureEvent* gesture = gestures->at(i).get(); + if (DispatchGestureEvent(gesture) != ui::GESTURE_STATUS_UNKNOWN) + handled = true; + } + return handled; +} + void RootWindow::ScheduleDraw() { if (!schedule_paint_factory_.HasWeakPtrs()) { MessageLoop::current()->PostTask( |