| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ | 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ |
| 6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ | 6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ui/display/display.h" | 10 #include "ui/display/display.h" |
| 11 #include "ui/display/display_layout.h" | 11 #include "ui/display/display_layout.h" |
| 12 #include "ui/display/manager/display_manager_export.h" | 12 #include "ui/display/manager/display_manager_export.h" |
| 13 #include "ui/display/manager/managed_display_info.h" | 13 #include "ui/display/manager/managed_display_info.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Point; | |
| 17 class Rect; | 16 class Rect; |
| 18 class Size; | 17 class Size; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace display { | 20 namespace display { |
| 22 class ManagedDisplayInfo; | 21 class ManagedDisplayInfo; |
| 23 class ManagedDisplayMode; | 22 class ManagedDisplayMode; |
| 24 | 23 |
| 25 // Creates the display mode list for internal display | 24 // Creates the display mode list for internal display |
| 26 // based on |native_mode|. | 25 // based on |native_mode|. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 55 bool HasDisplayModeForUIScale(const ManagedDisplayInfo& info, float ui_scale); | 54 bool HasDisplayModeForUIScale(const ManagedDisplayInfo& info, float ui_scale); |
| 56 | 55 |
| 57 // Computes the bounds that defines the bounds between two displays. | 56 // Computes the bounds that defines the bounds between two displays. |
| 58 // Returns false if two displays do not intersect. | 57 // Returns false if two displays do not intersect. |
| 59 DISPLAY_MANAGER_EXPORT bool ComputeBoundary( | 58 DISPLAY_MANAGER_EXPORT bool ComputeBoundary( |
| 60 const Display& primary_display, | 59 const Display& primary_display, |
| 61 const Display& secondary_display, | 60 const Display& secondary_display, |
| 62 gfx::Rect* primary_edge_in_screen, | 61 gfx::Rect* primary_edge_in_screen, |
| 63 gfx::Rect* secondary_edge_in_screen); | 62 gfx::Rect* secondary_edge_in_screen); |
| 64 | 63 |
| 65 // Returns the index in the displays whose bounds contains |point_in_screen|. | |
| 66 // Returns -1 if no such display exist. | |
| 67 DISPLAY_MANAGER_EXPORT int FindDisplayIndexContainingPoint( | |
| 68 const std::vector<Display>& displays, | |
| 69 const gfx::Point& point_in_screen); | |
| 70 | |
| 71 // Sorts id list using |CompareDisplayIds| below. | 64 // Sorts id list using |CompareDisplayIds| below. |
| 72 DISPLAY_MANAGER_EXPORT void SortDisplayIdList(DisplayIdList* list); | 65 DISPLAY_MANAGER_EXPORT void SortDisplayIdList(DisplayIdList* list); |
| 73 | 66 |
| 74 // Default id generator. | 67 // Default id generator. |
| 75 class DefaultDisplayIdGenerator { | 68 class DefaultDisplayIdGenerator { |
| 76 public: | 69 public: |
| 77 int64_t operator()(int64_t id) { return id; } | 70 int64_t operator()(int64_t id) { return id; } |
| 78 }; | 71 }; |
| 79 | 72 |
| 80 // Generate sorted DisplayIdList from iterators. | 73 // Generate sorted DisplayIdList from iterators. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 98 const DisplayIdList& list); | 91 const DisplayIdList& list); |
| 99 | 92 |
| 100 // Returns true if one of following conditions is met. | 93 // Returns true if one of following conditions is met. |
| 101 // 1) id1 is internal. | 94 // 1) id1 is internal. |
| 102 // 2) output index of id1 < output index of id2 and id2 isn't internal. | 95 // 2) output index of id1 < output index of id2 and id2 isn't internal. |
| 103 DISPLAY_MANAGER_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); | 96 DISPLAY_MANAGER_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); |
| 104 | 97 |
| 105 } // namespace display | 98 } // namespace display |
| 106 | 99 |
| 107 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ | 100 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ |
| OLD | NEW |