OLD | NEW |
---|---|
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 "ash/magnifier/partial_magnification_controller.h" | 5 #include "ash/magnifier/partial_magnification_controller.h" |
6 | 6 |
7 #include "ash/common/system/chromeos/palette/palette_utils.h" | |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
8 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
9 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
10 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
11 #include "ui/compositor/paint_recorder.h" | 12 #include "ui/compositor/paint_recorder.h" |
12 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
13 #include "ui/events/event_constants.h" | 14 #include "ui/events/event_constants.h" |
14 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
15 #include "ui/wm/core/coordinate_conversion.h" | 16 #include "ui/wm/core/coordinate_conversion.h" |
16 | 17 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 // If that failed for any reason return. | 196 // If that failed for any reason return. |
196 if (!host_widget_) { | 197 if (!host_widget_) { |
197 SetActive(false); | 198 SetActive(false); |
198 return; | 199 return; |
199 } | 200 } |
200 | 201 |
201 gfx::Point point = event->root_location(); | 202 gfx::Point point = event->root_location(); |
202 | 203 |
203 // Remap point from where it was captured to the display it is actually on. | 204 // Remap point from where it was captured to the display it is actually on. |
204 aura::Window* target = static_cast<aura::Window*>(event->target()); | 205 aura::Window* target = static_cast<aura::Window*>(event->target()); |
205 aura::Window* event_root = target->GetRootWindow(); | 206 aura::Window* event_root = target->GetRootWindow(); |
James Cook
2016/09/01 23:16:02
I would compute point_in_screen here (using ui/wm/
jdufault
2016/09/02 20:20:38
Done.
| |
206 aura::Window::ConvertPointToTarget( | 207 aura::Window::ConvertPointToTarget( |
207 event_root, host_widget_->GetNativeView()->GetRootWindow(), &point); | 208 event_root, host_widget_->GetNativeView()->GetRootWindow(), &point); |
208 | 209 |
209 host_widget_->SetBounds(GetBounds(point)); | 210 host_widget_->SetBounds(GetBounds(point)); |
210 | 211 |
211 event->StopPropagation(); | 212 if (!PaletteContainsEvent(event)) |
213 event->StopPropagation(); | |
212 } | 214 } |
213 | 215 |
214 void PartialMagnificationController::CreateMagnifierWindow( | 216 void PartialMagnificationController::CreateMagnifierWindow( |
215 aura::Window* root_window) { | 217 aura::Window* root_window) { |
216 if (host_widget_ || !root_window) | 218 if (host_widget_ || !root_window) |
217 return; | 219 return; |
218 | 220 |
219 root_window->AddObserver(this); | 221 root_window->AddObserver(this); |
220 | 222 |
221 gfx::Point mouse( | 223 gfx::Point mouse( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 | 269 |
268 void PartialMagnificationController::RemoveZoomWidgetObservers() { | 270 void PartialMagnificationController::RemoveZoomWidgetObservers() { |
269 DCHECK(host_widget_); | 271 DCHECK(host_widget_); |
270 host_widget_->RemoveObserver(this); | 272 host_widget_->RemoveObserver(this); |
271 aura::Window* root_window = host_widget_->GetNativeView()->GetRootWindow(); | 273 aura::Window* root_window = host_widget_->GetNativeView()->GetRootWindow(); |
272 DCHECK(root_window); | 274 DCHECK(root_window); |
273 root_window->RemoveObserver(this); | 275 root_window->RemoveObserver(this); |
274 } | 276 } |
275 | 277 |
276 } // namespace ash | 278 } // namespace ash |
OLD | NEW |