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/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 Window* window, | 100 Window* window, |
101 const ui::LocatedEvent& event) { | 101 const ui::LocatedEvent& event) { |
102 return SubtreeCanAcceptEvent(window, event) && | 102 return SubtreeCanAcceptEvent(window, event) && |
103 EventLocationInsideBounds(window, event); | 103 EventLocationInsideBounds(window, event); |
104 } | 104 } |
105 | 105 |
106 Window* WindowTargeter::FindTargetForKeyEvent(Window* window, | 106 Window* WindowTargeter::FindTargetForKeyEvent(Window* window, |
107 const ui::KeyEvent& key) { | 107 const ui::KeyEvent& key) { |
108 Window* root_window = window->GetRootWindow(); | 108 Window* root_window = window->GetRootWindow(); |
109 client::FocusClient* focus_client = client::GetFocusClient(root_window); | 109 client::FocusClient* focus_client = client::GetFocusClient(root_window); |
110 if (!focus_client) | |
111 return window; | |
sadrul
2016/07/20 16:58:36
Should this return nullptr?
halliwell
2016/07/20 17:01:42
tbh I don't understand this code well. But I was
| |
110 Window* focused_window = focus_client->GetFocusedWindow(); | 112 Window* focused_window = focus_client->GetFocusedWindow(); |
111 if (!focused_window) | 113 if (!focused_window) |
112 return window; | 114 return window; |
113 | 115 |
114 client::EventClient* event_client = client::GetEventClient(root_window); | 116 client::EventClient* event_client = client::GetEventClient(root_window); |
115 if (event_client && | 117 if (event_client && |
116 !event_client->CanProcessEventsWithinSubtree(focused_window)) { | 118 !event_client->CanProcessEventsWithinSubtree(focused_window)) { |
117 focus_client->FocusWindow(nullptr); | 119 focus_client->FocusWindow(nullptr); |
118 return nullptr; | 120 return nullptr; |
119 } | 121 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 static_cast<Window*>(targeter->FindTargetForEvent(child, event)); | 190 static_cast<Window*>(targeter->FindTargetForEvent(child, event)); |
189 if (child_target_window) | 191 if (child_target_window) |
190 return child_target_window; | 192 return child_target_window; |
191 } | 193 } |
192 target->ConvertEventToTarget(root_window, event); | 194 target->ConvertEventToTarget(root_window, event); |
193 } | 195 } |
194 return root_window->CanAcceptEvent(*event) ? root_window : nullptr; | 196 return root_window->CanAcceptEvent(*event) ? root_window : nullptr; |
195 } | 197 } |
196 | 198 |
197 } // namespace aura | 199 } // namespace aura |
OLD | NEW |