OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/window_targeter.h" | 5 #include "ui/aura/window_targeter.h" |
6 | 6 |
7 #include "ui/aura/client/capture_client.h" | 7 #include "ui/aura/client/capture_client.h" |
8 #include "ui/aura/client/event_client.h" | 8 #include "ui/aura/client/event_client.h" |
9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); | 95 WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
96 if (dispatcher->mouse_pressed_handler()) | 96 if (dispatcher->mouse_pressed_handler()) |
97 return dispatcher->mouse_pressed_handler(); | 97 return dispatcher->mouse_pressed_handler(); |
98 } | 98 } |
99 | 99 |
100 // All events should be directed towards the capture window (if any). | 100 // All events should be directed towards the capture window (if any). |
101 Window* capture_window = client::GetCaptureWindow(root_window); | 101 Window* capture_window = client::GetCaptureWindow(root_window); |
102 if (capture_window) | 102 if (capture_window) |
103 return capture_window; | 103 return capture_window; |
104 | 104 |
| 105 if (event.IsTouchEvent()) { |
| 106 // Query the gesture-recognizer to find targets for touch events. |
| 107 const ui::TouchEvent& touch = static_cast<const ui::TouchEvent&>(event); |
| 108 ui::GestureConsumer* consumer = |
| 109 ui::GestureRecognizer::Get()->GetTouchLockedTarget(touch); |
| 110 if (consumer) |
| 111 return static_cast<Window*>(consumer); |
| 112 consumer = |
| 113 ui::GestureRecognizer::Get()->GetTargetForLocation(event.location()); |
| 114 if (consumer) |
| 115 return static_cast<Window*>(consumer); |
| 116 |
| 117 // If the initial touch is outside the root window, target the root. |
| 118 if (!root_window->bounds().Contains(event.location())) |
| 119 return root_window; |
| 120 } |
| 121 |
105 return NULL; | 122 return NULL; |
106 } | 123 } |
107 | 124 |
108 } // namespace aura | 125 } // namespace aura |
OLD | NEW |