[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef ASH_SCREEN_UTIL_H_ |
| 6 | #define ASH_SCREEN_UTIL_H_ |
| 7 | |
| 8 | #include "ash/ash_export.h" |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 9 | |
| 10 | namespace aura { |
| 11 | class Window; |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 12 | } // namespace aura |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 13 | |
oshima | 06b3960 | 2016-05-11 02:40:10 | [diff] [blame] | 14 | namespace gfx { |
| 15 | class Rect; |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 16 | } // namespace gfx |
oshima | f84b0da72 | 2016-04-27 19:47:19 | [diff] [blame] | 17 | |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 18 | namespace ash { |
| 19 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 20 | namespace screen_util { |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 21 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 22 | // Returns the bounds for maximized windows in parent coordinates. |
| 23 | // Maximized windows trigger auto-hiding the shelf. |
| 24 | ASH_EXPORT gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 25 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 26 | // Returns the display bounds in parent coordinates. |
| 27 | ASH_EXPORT gfx::Rect GetDisplayBoundsInParent(aura::Window* window); |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 28 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 29 | // Returns the display's work area bounds in parent coordinates. |
| 30 | ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window); |
tbarzic | 98adf00 | 2017-05-26 17:28:17 | [diff] [blame] | 31 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 32 | // Returns the display's work area bounds in parent coordinates on lock |
| 33 | // screen, i.e. for work area with forced bottom alignment. |
| 34 | // Note that unlike |GetDisplayWorkAreaBoundsInParent|, this method uses |
| 35 | // work area bounds that are updated when the screen is locked. For example |
| 36 | // if shelf alignment is set to right before screen lock, |
| 37 | // |GetDisplayWorkAreaBoundsInParent| will return work are bounds for right |
| 38 | // shelf alignment - this method will return work area for bottom shelf |
| 39 | // alignment (which is always used on lock screen). |
| 40 | ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParentForLockScreen( |
| 41 | aura::Window* window); |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 42 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 43 | // Returns the bounds of the physical display containing the shelf for |
| 44 | // |window|. Physical displays can differ from logical displays in unified |
| 45 | // desktop mode. |
| 46 | // TODO(oshima): Consider using physical displays in window layout, instead of |
| 47 | // root windows, and only use logical display in display management code. |
| 48 | ASH_EXPORT gfx::Rect GetDisplayBoundsWithShelf(aura::Window* window); |
| 49 | |
Malay Keshav | fd6fd0c | 2018-07-31 22:07:47 | [diff] [blame] | 50 | // Returns an adjusted bounds for the given |bounds| by false snapping it to the |
| 51 | // edge of the display in pixel space. It will snap the bounds to the display |
| 52 | // that contains |window|. This will prevent any 1px gaps that you might see at |
| 53 | // the edges of the display. We achieve this by increasing the height and/or the |
| 54 | // width of |bounds| so that in pixel space, they cover the edge of the dispaly. |
| 55 | // |bounds| should be in screen space. |
| 56 | ASH_EXPORT gfx::Rect SnapBoundsToDisplayEdge(const gfx::Rect& bounds, |
| 57 | const aura::Window* window); |
| 58 | |
Qiang Xu | 07d7c9e3 | 2018-01-18 20:25:44 | [diff] [blame] | 59 | } // namespace screen_util |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 60 | |
| 61 | } // namespace ash |
| 62 | |
| 63 | #endif // ASH_SCREEN_UTIL_H_ |