| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/screen_ash.h" | 5 #include "ash/display/screen_ash.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_widget.h" | 7 #include "ash/common/shelf/shelf_widget.h" |
| 8 #include "ash/common/wm/root_window_finder.h" | 8 #include "ash/common/wm/root_window_finder.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/display/window_tree_host_manager.h" | 10 #include "ash/display/window_tree_host_manager.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 ScreenAsh::ScreenAsh() {} | 84 ScreenAsh::ScreenAsh() {} |
| 85 | 85 |
| 86 ScreenAsh::~ScreenAsh() {} | 86 ScreenAsh::~ScreenAsh() {} |
| 87 | 87 |
| 88 gfx::Point ScreenAsh::GetCursorScreenPoint() { | 88 gfx::Point ScreenAsh::GetCursorScreenPoint() { |
| 89 return aura::Env::GetInstance()->last_mouse_location(); | 89 return aura::Env::GetInstance()->last_mouse_location(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool ScreenAsh::IsWindowUnderCursor(gfx::NativeWindow window) { | 92 bool ScreenAsh::IsWindowUnderCursor(gfx::NativeWindow window) { |
| 93 return GetWindowAtScreenPoint( | 93 return window->Contains(GetWindowAtScreenPoint( |
| 94 display::Screen::GetScreen()->GetCursorScreenPoint()) == window; | 94 display::Screen::GetScreen()->GetCursorScreenPoint())); |
| 95 } | 95 } |
| 96 | 96 |
| 97 gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) { | 97 gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 98 aura::Window* root_window = | 98 aura::Window* root_window = |
| 99 WmWindow::GetAuraWindow(wm::GetRootWindowAt(point)); | 99 WmWindow::GetAuraWindow(wm::GetRootWindowAt(point)); |
| 100 aura::client::ScreenPositionClient* position_client = | 100 aura::client::ScreenPositionClient* position_client = |
| 101 aura::client::GetScreenPositionClient(root_window); | 101 aura::client::GetScreenPositionClient(root_window); |
| 102 | 102 |
| 103 gfx::Point local_point = point; | 103 gfx::Point local_point = point; |
| 104 if (position_client) | 104 if (position_client) |
| 105 position_client->ConvertPointFromScreen(root_window, &local_point); | 105 position_client->ConvertPointFromScreen(root_window, &local_point); |
| 106 | 106 |
| 107 return root_window->GetTopWindowContainingPoint(local_point); | 107 return root_window->GetEventHandlerForPoint(local_point); |
| 108 } | 108 } |
| 109 | 109 |
| 110 int ScreenAsh::GetNumDisplays() const { | 110 int ScreenAsh::GetNumDisplays() const { |
| 111 return GetDisplayManager()->GetNumDisplays(); | 111 return GetDisplayManager()->GetNumDisplays(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 const std::vector<display::Display>& ScreenAsh::GetAllDisplays() const { | 114 const std::vector<display::Display>& ScreenAsh::GetAllDisplays() const { |
| 115 return GetDisplayManager()->active_display_list(); | 115 return GetDisplayManager()->active_display_list(); |
| 116 } | 116 } |
| 117 | 117 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 // static | 191 // static |
| 192 void ScreenAsh::CreateScreenForShutdown() { | 192 void ScreenAsh::CreateScreenForShutdown() { |
| 193 delete screen_for_shutdown; | 193 delete screen_for_shutdown; |
| 194 screen_for_shutdown = new ScreenForShutdown(display::Screen::GetScreen()); | 194 screen_for_shutdown = new ScreenForShutdown(display::Screen::GetScreen()); |
| 195 display::Screen::SetScreenInstance(screen_for_shutdown); | 195 display::Screen::SetScreenInstance(screen_for_shutdown); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |