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

Side by Side Diff: ui/aura/root_window.cc

Issue 10306014: Calibrating touch input (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed log entries 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/base/ui_base_switches.h » ('j') | ui/base/ui_base_switches.cc » ('J')
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/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (!target) { 304 if (!target) {
305 target = static_cast<Window*>( 305 target = static_cast<Window*>(
306 gesture_recognizer_->GetTargetForLocation(event->GetLocation())); 306 gesture_recognizer_->GetTargetForLocation(event->GetLocation()));
307 } 307 }
308 308
309 if (!target && !bounds().Contains(event->location())) { 309 if (!target && !bounds().Contains(event->location())) {
310 // If the touch is outside the root window, set its target to the 310 // If the touch is outside the root window, set its target to the
311 // root window. 311 // root window.
312 target = this; 312 target = this;
313 } else { 313 } else {
314 // We only come here when the first contact was within the root window.
314 if (!target) 315 if (!target)
315 target = GetEventHandlerForPoint(event->location()); 316 target = GetEventHandlerForPoint(event->location());
316 if (!target) 317 if (!target)
317 return false; 318 return false;
318 319
319 TouchEvent translated_event(*event, this, target); 320 TouchEvent translated_event(*event, this, target);
320 status = ProcessTouchEvent(target, &translated_event); 321 status = ProcessTouchEvent(target, &translated_event);
321 handled = status != ui::TOUCH_STATUS_UNKNOWN; 322 handled = status != ui::TOUCH_STATUS_UNKNOWN;
322 323
323 if (status == ui::TOUCH_STATUS_QUEUED || 324 if (status == ui::TOUCH_STATUS_QUEUED ||
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 return false; 653 return false;
653 return target->delegate()->OnKeyEvent(event); 654 return target->delegate()->OnKeyEvent(event);
654 } 655 }
655 656
656 ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target, 657 ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target,
657 TouchEvent* event) { 658 TouchEvent* event) {
658 if (!target->IsVisible()) 659 if (!target->IsVisible())
659 return ui::TOUCH_STATUS_UNKNOWN; 660 return ui::TOUCH_STATUS_UNKNOWN;
660 661
661 EventFilters filters; 662 EventFilters filters;
662 GetEventFiltersToNotify(target->parent(), &filters); 663 if (target == this)
664 GetEventFiltersToNotify(target, &filters);
665 else
666 GetEventFiltersToNotify(target->parent(), &filters);
663 for (EventFilters::const_reverse_iterator it = filters.rbegin(), 667 for (EventFilters::const_reverse_iterator it = filters.rbegin(),
664 rend = filters.rend(); 668 rend = filters.rend();
665 it != rend; ++it) { 669 it != rend; ++it) {
666 ui::TouchStatus status = (*it)->PreHandleTouchEvent(target, event); 670 ui::TouchStatus status = (*it)->PreHandleTouchEvent(target, event);
667 if (status != ui::TOUCH_STATUS_UNKNOWN) 671 if (status != ui::TOUCH_STATUS_UNKNOWN)
668 return status; 672 return status;
669 } 673 }
670 674
671 return target->delegate()->OnTouchEvent(event); 675 if (target->delegate())
676 return target->delegate()->OnTouchEvent(event);
677
678 return ui::TOUCH_STATUS_UNKNOWN;
672 } 679 }
673 680
674 ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target, 681 ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target,
675 GestureEvent* event) { 682 GestureEvent* event) {
676 if (!target->IsVisible()) 683 if (!target->IsVisible())
677 return ui::GESTURE_STATUS_UNKNOWN; 684 return ui::GESTURE_STATUS_UNKNOWN;
678 685
679 EventFilters filters; 686 EventFilters filters;
680 if (target == this) 687 if (target == this)
681 GetEventFiltersToNotify(target, &filters); 688 GetEventFiltersToNotify(target, &filters);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 void RootWindow::UnlockCompositor() { 993 void RootWindow::UnlockCompositor() {
987 DCHECK(compositor_lock_); 994 DCHECK(compositor_lock_);
988 compositor_lock_ = NULL; 995 compositor_lock_ = NULL;
989 if (draw_on_compositor_unlock_) { 996 if (draw_on_compositor_unlock_) {
990 draw_on_compositor_unlock_ = false; 997 draw_on_compositor_unlock_ = false;
991 ScheduleDraw(); 998 ScheduleDraw();
992 } 999 }
993 } 1000 }
994 1001
995 } // namespace aura 1002 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/base/ui_base_switches.h » ('j') | ui/base/ui_base_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698