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/display/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 size_t MultiDisplayManager::GetNumDisplays() const { | 310 size_t MultiDisplayManager::GetNumDisplays() const { |
311 return displays_.size(); | 311 return displays_.size(); |
312 } | 312 } |
313 | 313 |
314 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( | 314 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( |
315 const Window* window) const { | 315 const Window* window) const { |
316 if (!window) | 316 if (!window) |
317 return DisplayController::GetPrimaryDisplay(); | 317 return DisplayController::GetPrimaryDisplay(); |
318 const RootWindow* root = window->GetRootWindow(); | 318 const RootWindow* root = window->GetRootWindow(); |
319 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); | 319 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); |
320 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); | 320 return root ? |
| 321 manager->FindDisplayForRootWindow(root) : |
| 322 *manager->GetDisplayAt(0); |
321 } | 323 } |
322 | 324 |
323 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( | 325 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( |
324 const gfx::Point& point) const { | 326 const gfx::Point& point) const { |
325 // Fallback to the primary display if there is no root display containing | 327 // Fallback to the primary display if there is no root display containing |
326 // the |point|. | 328 // the |point|. |
327 const gfx::Display& display = FindDisplayContainingPoint(point); | 329 const gfx::Display& display = FindDisplayContainingPoint(point); |
328 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); | 330 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); |
329 } | 331 } |
330 | 332 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 DisplayList::iterator iter_to_update = to_update->begin(); | 483 DisplayList::iterator iter_to_update = to_update->begin(); |
482 DisplayList::const_iterator iter = displays_.begin(); | 484 DisplayList::const_iterator iter = displays_.begin(); |
483 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 485 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
484 ++iter, ++iter_to_update) { | 486 ++iter, ++iter_to_update) { |
485 (*iter_to_update).set_id((*iter).id()); | 487 (*iter_to_update).set_id((*iter).id()); |
486 } | 488 } |
487 } | 489 } |
488 | 490 |
489 } // namespace internal | 491 } // namespace internal |
490 } // namespace ash | 492 } // namespace ash |
OLD | NEW |