jamescook@chromium.org | b52a3f3 | 2012-01-17 19:12:04 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
ben@chromium.org | a419752 | 2011-11-30 23:38:41 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
ben@chromium.org | a3301dc | 2011-12-23 16:34:51 | [diff] [blame] | 5 | #ifndef ASH_WM_WINDOW_UTIL_H_ |
| 6 | #define ASH_WM_WINDOW_UTIL_H_ |
ben@chromium.org | a419752 | 2011-11-30 23:38:41 | [diff] [blame] | 7 | |
msw | c30c277 | 2017-02-16 20:08:17 | [diff] [blame] | 8 | #include <stdint.h> |
Sammie Quon | 171bbc7 | 2018-11-30 02:58:54 | [diff] [blame] | 9 | #include <vector> |
msw | c30c277 | 2017-02-16 20:08:17 | [diff] [blame] | 10 | |
ben@chromium.org | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 11 | #include "ash/ash_export.h" |
sky@chromium.org | fb4d9d1 | 2012-08-24 00:44:54 | [diff] [blame] | 12 | #include "ui/base/ui_base_types.h" |
sadrul@chromium.org | 7d2c7f9 | 2011-12-02 17:05:37 | [diff] [blame] | 13 | |
ben@chromium.org | a419752 | 2011-11-30 23:38:41 | [diff] [blame] | 14 | namespace aura { |
| 15 | class Window; |
| 16 | } |
| 17 | |
sky | cd9d4ae | 2017-05-25 19:38:33 | [diff] [blame] | 18 | namespace gfx { |
| 19 | class Point; |
| 20 | } |
| 21 | |
yusukes@chromium.org | 89cfbbd | 2012-08-16 02:00:05 | [diff] [blame] | 22 | namespace ui { |
stevenjb@chromium.org | 0419d72 | 2013-04-05 16:16:08 | [diff] [blame] | 23 | class Event; |
yusukes@chromium.org | 89cfbbd | 2012-08-16 02:00:05 | [diff] [blame] | 24 | } |
| 25 | |
ben@chromium.org | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 26 | namespace ash { |
varkha | c8621dd | 2017-05-31 19:09:01 | [diff] [blame] | 27 | |
sky | 0702b27 | 2016-06-03 22:10:41 | [diff] [blame] | 28 | namespace wm { |
| 29 | |
oshima@chromium.org | a41b4e1 | 2013-09-20 04:36:34 | [diff] [blame] | 30 | // Utility functions for window activation. |
James Cook | 5163dd7 | 2017-09-12 21:16:17 | [diff] [blame] | 31 | // DEPRECATED: Prefer the functions in ui/wm/core/window_util.h. |
ben@chromium.org | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 32 | ASH_EXPORT void ActivateWindow(aura::Window* window); |
| 33 | ASH_EXPORT void DeactivateWindow(aura::Window* window); |
| 34 | ASH_EXPORT bool IsActiveWindow(aura::Window* window); |
| 35 | ASH_EXPORT aura::Window* GetActiveWindow(); |
yoshiki@chromium.org | 3ca185c | 2012-03-28 18:08:22 | [diff] [blame] | 36 | ASH_EXPORT bool CanActivateWindow(aura::Window* window); |
sky | 9e1148f | 2017-03-31 20:59:07 | [diff] [blame] | 37 | ASH_EXPORT aura::Window* GetFocusedWindow(); |
ben@chromium.org | 9fc206d | 2011-12-13 00:05:33 | [diff] [blame] | 38 | |
| 39 | // Retrieves the activatable window for |window|. If |window| is activatable, |
| 40 | // this will just return it, otherwise it will climb the parent/transient parent |
| 41 | // chain looking for a window that is activatable, per the ActivationController. |
| 42 | // If you're looking for a function to get the activatable "top level" window, |
| 43 | // this is probably what you're looking for. |
ben@chromium.org | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 44 | ASH_EXPORT aura::Window* GetActivatableWindow(aura::Window* window); |
ben@chromium.org | 9fc206d | 2011-12-13 00:05:33 | [diff] [blame] | 45 | |
sky | 9e1148f | 2017-03-31 20:59:07 | [diff] [blame] | 46 | // Returns the window with capture, null if no window currently has capture. |
| 47 | ASH_EXPORT aura::Window* GetCaptureWindow(); |
| 48 | |
Scott Violet | 0c0dcde | 2017-08-04 21:48:18 | [diff] [blame] | 49 | // Returns the Windows that may block events. |
| 50 | // If |min_container| is non-null then windows that are not children of |
| 51 | // |min_container| or not stacked above (z-order) will not receive events. |
| 52 | // |system_modal_container| is the window system modal windows appear in. If |
| 53 | // there is a system modal window in it, then events that are not targetted |
| 54 | // at the active modal window (or an ancestor or transient ancestor) will not |
| 55 | // receive events. |
| 56 | ASH_EXPORT void GetBlockingContainersForRoot( |
| 57 | aura::Window* root_window, |
| 58 | aura::Window** min_container, |
| 59 | aura::Window** system_modal_container); |
| 60 | |
bruthig | b7056f6 | 2015-06-04 21:04:53 | [diff] [blame] | 61 | // Returns true if |window|'s location can be controlled by the user. |
| 62 | ASH_EXPORT bool IsWindowUserPositionable(aura::Window* window); |
| 63 | |
hidehiko | 066b6f7 | 2016-06-16 12:29:10 | [diff] [blame] | 64 | // Pins the window on top of other windows. |
hirono | 94b6193 | 2016-09-20 05:28:06 | [diff] [blame] | 65 | ASH_EXPORT void PinWindow(aura::Window* window, bool trusted); |
hidehiko | 066b6f7 | 2016-06-16 12:29:10 | [diff] [blame] | 66 | |
yorkelee | 74669cb | 2017-03-30 22:22:07 | [diff] [blame] | 67 | // Indicates that the window should autohide the shelf when it is the active |
| 68 | // window. |
| 69 | ASH_EXPORT void SetAutoHideShelf(aura::Window* window, bool autohide); |
| 70 | |
msw | c30c277 | 2017-02-16 20:08:17 | [diff] [blame] | 71 | // Moves |window| to the root window for the given |display_id|, if it is not |
| 72 | // already in the same root window. Returns true if |window| was moved. |
| 73 | ASH_EXPORT bool MoveWindowToDisplay(aura::Window* window, int64_t display_id); |
| 74 | |
| 75 | // Moves |window| to the root window where the |event| occurred, if it is not |
flackr@chromium.org | 6bda963 | 2013-04-06 10:33:37 | [diff] [blame] | 76 | // already in the same root window. Returns true if |window| was moved. |
| 77 | ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window, |
stevenjb@chromium.org | 0419d72 | 2013-04-05 16:16:08 | [diff] [blame] | 78 | const ui::Event& event); |
| 79 | |
oshima@chromium.org | 1ca79d4 | 2014-07-18 16:26:10 | [diff] [blame] | 80 | // Mark the container window so that InstallSnapLayoutManagerToContainers |
| 81 | // installs the SnapToPixelLayoutManager. |
| 82 | ASH_EXPORT void SetSnapsChildrenToPhysicalPixelBoundary( |
| 83 | aura::Window* container); |
| 84 | |
sky | cd9d4ae | 2017-05-25 19:38:33 | [diff] [blame] | 85 | // Convenience for window->delegate()->GetNonClientComponent(location) that |
| 86 | // returns HTNOWHERE if window->delegate() is null. |
| 87 | ASH_EXPORT int GetNonClientComponent(aura::Window* window, |
| 88 | const gfx::Point& location); |
| 89 | |
varkha | 515b4346 | 2017-05-26 23:21:27 | [diff] [blame] | 90 | // When set, the child windows should get a slightly larger hit region to make |
| 91 | // resizing easier. |
| 92 | ASH_EXPORT void SetChildrenUseExtendedHitRegionForWindow(aura::Window* window); |
varkha | 515b4346 | 2017-05-26 23:21:27 | [diff] [blame] | 93 | |
varkha | ae5decc | 2017-05-26 20:05:38 | [diff] [blame] | 94 | // Requests the |window| to close and destroy itself. This is intended to |
| 95 | // forward to an associated widget. |
| 96 | ASH_EXPORT void CloseWidgetForWindow(aura::Window* window); |
| 97 | |
varkha | c8621dd | 2017-05-31 19:09:01 | [diff] [blame] | 98 | // Installs a resize handler on the window that makes it easier to resize |
Evan Stade | 60e12fc | 2018-09-18 21:18:22 | [diff] [blame] | 99 | // the window. |
varkha | c8621dd | 2017-05-31 19:09:01 | [diff] [blame] | 100 | ASH_EXPORT void InstallResizeHandleWindowTargeterForWindow( |
Evan Stade | 60e12fc | 2018-09-18 21:18:22 | [diff] [blame] | 101 | aura::Window* window); |
varkha | c8621dd | 2017-05-31 19:09:01 | [diff] [blame] | 102 | |
Xiaoqian Dai | 82d9919 | 2018-05-25 18:51:35 | [diff] [blame] | 103 | // Returns true if |window| is currently in tab-dragging process. |
| 104 | ASH_EXPORT bool IsDraggingTabs(const aura::Window* window); |
| 105 | |
Sammie Quon | 1c2052a | 2018-11-29 01:20:24 | [diff] [blame] | 106 | // Returns true if |window| should be excluded from the cycle list and/or |
| 107 | // overview. |
| 108 | ASH_EXPORT bool ShouldExcludeForBothCycleListAndOverview( |
| 109 | const aura::Window* window); |
| 110 | ASH_EXPORT bool ShouldExcludeForCycleList(const aura::Window* window); |
| 111 | ASH_EXPORT bool ShouldExcludeForOverview(const aura::Window* window); |
| 112 | |
Sammie Quon | 171bbc7 | 2018-11-30 02:58:54 | [diff] [blame] | 113 | // Removes all windows in |out_window_list| whose transient root is also in |
| 114 | // |out_window_list|. This is used by overview and window cycler to avoid |
| 115 | // showing multiple previews for windows linked by transient. |
| 116 | ASH_EXPORT void RemoveTransientDescendants( |
| 117 | std::vector<aura::Window*>* out_window_list); |
| 118 | |
tfarina@chromium.org | 70a2c84 | 2012-02-28 23:46:02 | [diff] [blame] | 119 | } // namespace wm |
ben@chromium.org | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 120 | } // namespace ash |
ben@chromium.org | a419752 | 2011-11-30 23:38:41 | [diff] [blame] | 121 | |
ben@chromium.org | a3301dc | 2011-12-23 16:34:51 | [diff] [blame] | 122 | #endif // ASH_WM_WINDOW_UTIL_H_ |