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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return NULL; | 421 return NULL; |
422 } | 422 } |
423 | 423 |
424 // static | 424 // static |
425 void Window::ConvertPointToTarget(const Window* source, | 425 void Window::ConvertPointToTarget(const Window* source, |
426 const Window* target, | 426 const Window* target, |
427 gfx::Point* point) { | 427 gfx::Point* point) { |
428 if (!source) | 428 if (!source) |
429 return; | 429 return; |
430 if (source->GetRootWindow() != target->GetRootWindow()) { | 430 if (source->GetRootWindow() != target->GetRootWindow()) { |
431 const gfx::Point source_origin = | 431 Window* source_window = const_cast<Window*>(source); |
432 gfx::Screen::GetDisplayNearestWindow( | 432 Window* target_window = const_cast<Window*>(target); |
433 const_cast<Window*>(source)).bounds().origin(); | 433 const gfx::Point source_origin = gfx::Screen::GetScreenFor(source_window)-> |
434 const gfx::Point target_origin = | 434 GetDisplayNearestWindow(source_window).bounds().origin(); |
435 gfx::Screen::GetDisplayNearestWindow( | 435 const gfx::Point target_origin = gfx::Screen::GetScreenFor(target_window)-> |
436 const_cast<Window*>(target)).bounds().origin(); | 436 GetDisplayNearestWindow(target_window).bounds().origin(); |
437 ui::Layer::ConvertPointToLayer( | 437 ui::Layer::ConvertPointToLayer( |
438 source->layer(), source->GetRootWindow()->layer(), point); | 438 source->layer(), source->GetRootWindow()->layer(), point); |
439 const gfx::Point offset = source_origin.Subtract(target_origin); | 439 const gfx::Point offset = source_origin.Subtract(target_origin); |
440 point->Offset(offset.x(), offset.y()); | 440 point->Offset(offset.x(), offset.y()); |
441 ui::Layer::ConvertPointToLayer( | 441 ui::Layer::ConvertPointToLayer( |
442 target->GetRootWindow()->layer(), target->layer(), point); | 442 target->GetRootWindow()->layer(), target->layer(), point); |
443 } else { | 443 } else { |
444 ui::Layer::ConvertPointToLayer(source->layer(), target->layer(), point); | 444 ui::Layer::ConvertPointToLayer(source->layer(), target->layer(), point); |
445 } | 445 } |
446 } | 446 } |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 bool contains_mouse = false; | 973 bool contains_mouse = false; |
974 if (IsVisible()) { | 974 if (IsVisible()) { |
975 RootWindow* root_window = GetRootWindow(); | 975 RootWindow* root_window = GetRootWindow(); |
976 contains_mouse = root_window && | 976 contains_mouse = root_window && |
977 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); | 977 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); |
978 } | 978 } |
979 return contains_mouse; | 979 return contains_mouse; |
980 } | 980 } |
981 | 981 |
982 } // namespace aura | 982 } // namespace aura |
OLD | NEW |