| 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 #ifndef ASH_DISPLAY_DISPLAY_UTIL_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_UTIL_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_UTIL_H_ | 6 #define ASH_DISPLAY_DISPLAY_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
| 15 #include "ui/display/manager/display_layout.h" | 15 #include "ui/display/manager/display_layout.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Display; | |
| 19 class Point; | 18 class Point; |
| 20 class Rect; | 19 class Rect; |
| 21 class Size; | 20 class Size; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace ash { | 23 namespace ash { |
| 25 class AshWindowTreeHost; | 24 class AshWindowTreeHost; |
| 26 struct DisplayMode; | 25 struct DisplayMode; |
| 27 class DisplayInfo; | 26 class DisplayInfo; |
| 28 | 27 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 | 56 |
| 58 // Sets the UI scale for the |display_id|. Returns false if the | 57 // Sets the UI scale for the |display_id|. Returns false if the |
| 59 // display_id is not an internal display. | 58 // display_id is not an internal display. |
| 60 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); | 59 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); |
| 61 | 60 |
| 62 // Tests if the |info| has display mode that matches |ui_scale|. | 61 // Tests if the |info| has display mode that matches |ui_scale|. |
| 63 bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale); | 62 bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale); |
| 64 | 63 |
| 65 // Computes the bounds that defines the bounds between two displays. | 64 // Computes the bounds that defines the bounds between two displays. |
| 66 // Returns false if two displays do not intersect. | 65 // Returns false if two displays do not intersect. |
| 67 bool ComputeBoundary(const gfx::Display& primary_display, | 66 bool ComputeBoundary(const display::Display& primary_display, |
| 68 const gfx::Display& secondary_display, | 67 const display::Display& secondary_display, |
| 69 gfx::Rect* primary_edge_in_screen, | 68 gfx::Rect* primary_edge_in_screen, |
| 70 gfx::Rect* secondary_edge_in_screen); | 69 gfx::Rect* secondary_edge_in_screen); |
| 71 | 70 |
| 72 // Creates edge bounds from |bounds_in_screen| that fits the edge | 71 // Creates edge bounds from |bounds_in_screen| that fits the edge |
| 73 // of the native window for |ash_host|. | 72 // of the native window for |ash_host|. |
| 74 ASH_EXPORT gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host, | 73 ASH_EXPORT gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host, |
| 75 const gfx::Rect& bounds_in_screen); | 74 const gfx::Rect& bounds_in_screen); |
| 76 | 75 |
| 77 // Moves the cursor to the point inside the |ash_host| that is closest to | 76 // Moves the cursor to the point inside the |ash_host| that is closest to |
| 78 // the point_in_screen, which may be outside of the root window. | 77 // the point_in_screen, which may be outside of the root window. |
| 79 // |update_last_loation_now| is used for the test to update the mouse | 78 // |update_last_loation_now| is used for the test to update the mouse |
| 80 // location synchronously. | 79 // location synchronously. |
| 81 void MoveCursorTo(AshWindowTreeHost* ash_host, | 80 void MoveCursorTo(AshWindowTreeHost* ash_host, |
| 82 const gfx::Point& point_in_screen, | 81 const gfx::Point& point_in_screen, |
| 83 bool update_last_location_now); | 82 bool update_last_location_now); |
| 84 | 83 |
| 85 // Returns the index in the displays whose bounds contains |point_in_screen|. | 84 // Returns the index in the displays whose bounds contains |point_in_screen|. |
| 86 // Returns -1 if no such display exist. | 85 // Returns -1 if no such display exist. |
| 87 ASH_EXPORT int FindDisplayIndexContainingPoint( | 86 ASH_EXPORT int FindDisplayIndexContainingPoint( |
| 88 const std::vector<gfx::Display>& displays, | 87 const std::vector<display::Display>& displays, |
| 89 const gfx::Point& point_in_screen); | 88 const gfx::Point& point_in_screen); |
| 90 | 89 |
| 91 // Sorts id list using |CompareDisplayIds| below. | 90 // Sorts id list using |CompareDisplayIds| below. |
| 92 ASH_EXPORT void SortDisplayIdList(display::DisplayIdList* list); | 91 ASH_EXPORT void SortDisplayIdList(display::DisplayIdList* list); |
| 93 | 92 |
| 94 // Default id generator. | 93 // Default id generator. |
| 95 class DefaultDisplayIdGenerator { | 94 class DefaultDisplayIdGenerator { |
| 96 public: | 95 public: |
| 97 int64_t operator()(int64_t id) { return id; } | 96 int64_t operator()(int64_t id) { return id; } |
| 98 }; | 97 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 120 const display::DisplayIdList& list); | 119 const display::DisplayIdList& list); |
| 121 | 120 |
| 122 // Returns true if one of following conditinos is met. | 121 // Returns true if one of following conditinos is met. |
| 123 // 1) id1 is internal. | 122 // 1) id1 is internal. |
| 124 // 2) output index of id1 < output index of id2 and id2 isn't internal. | 123 // 2) output index of id1 < output index of id2 and id2 isn't internal. |
| 125 ASH_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); | 124 ASH_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); |
| 126 | 125 |
| 127 } // namespace ash | 126 } // namespace ash |
| 128 | 127 |
| 129 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ | 128 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ |
| OLD | NEW |