[go: nahoru, domu]

blob: 40f46075198a0ffd36c1a46168231079c464f7df [file] [log] [blame]
jamescook@chromium.orgb52a3f32012-01-17 19:12:041// Copyright (c) 2012 The Chromium Authors. All rights reserved.
ben@chromium.orga4197522011-11-30 23:38:412// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
ben@chromium.orga3301dc2011-12-23 16:34:515#ifndef ASH_WM_WINDOW_UTIL_H_
6#define ASH_WM_WINDOW_UTIL_H_
ben@chromium.orga4197522011-11-30 23:38:417
mswc30c2772017-02-16 20:08:178#include <stdint.h>
Sammie Quon171bbc72018-11-30 02:58:549#include <vector>
mswc30c2772017-02-16 20:08:1710
ben@chromium.orgb65bdda2011-12-23 23:35:3111#include "ash/ash_export.h"
sky@chromium.orgfb4d9d12012-08-24 00:44:5412#include "ui/base/ui_base_types.h"
sadrul@chromium.org7d2c7f92011-12-02 17:05:3713
ben@chromium.orga4197522011-11-30 23:38:4114namespace aura {
15class Window;
16}
17
skycd9d4ae2017-05-25 19:38:3318namespace gfx {
19class Point;
20}
21
yusukes@chromium.org89cfbbd2012-08-16 02:00:0522namespace ui {
stevenjb@chromium.org0419d722013-04-05 16:16:0823class Event;
yusukes@chromium.org89cfbbd2012-08-16 02:00:0524}
25
ben@chromium.org55f593352011-12-24 05:42:4626namespace ash {
varkhac8621dd2017-05-31 19:09:0127
sky0702b272016-06-03 22:10:4128namespace wm {
29
oshima@chromium.orga41b4e12013-09-20 04:36:3430// Utility functions for window activation.
James Cook5163dd72017-09-12 21:16:1731// DEPRECATED: Prefer the functions in ui/wm/core/window_util.h.
ben@chromium.orgb65bdda2011-12-23 23:35:3132ASH_EXPORT void ActivateWindow(aura::Window* window);
33ASH_EXPORT void DeactivateWindow(aura::Window* window);
34ASH_EXPORT bool IsActiveWindow(aura::Window* window);
35ASH_EXPORT aura::Window* GetActiveWindow();
yoshiki@chromium.org3ca185c2012-03-28 18:08:2236ASH_EXPORT bool CanActivateWindow(aura::Window* window);
sky9e1148f2017-03-31 20:59:0737ASH_EXPORT aura::Window* GetFocusedWindow();
ben@chromium.org9fc206d2011-12-13 00:05:3338
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.orgb65bdda2011-12-23 23:35:3144ASH_EXPORT aura::Window* GetActivatableWindow(aura::Window* window);
ben@chromium.org9fc206d2011-12-13 00:05:3345
sky9e1148f2017-03-31 20:59:0746// Returns the window with capture, null if no window currently has capture.
47ASH_EXPORT aura::Window* GetCaptureWindow();
48
Scott Violet0c0dcde2017-08-04 21:48:1849// 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.
56ASH_EXPORT void GetBlockingContainersForRoot(
57 aura::Window* root_window,
58 aura::Window** min_container,
59 aura::Window** system_modal_container);
60
bruthigb7056f62015-06-04 21:04:5361// Returns true if |window|'s location can be controlled by the user.
62ASH_EXPORT bool IsWindowUserPositionable(aura::Window* window);
63
hidehiko066b6f72016-06-16 12:29:1064// Pins the window on top of other windows.
hirono94b61932016-09-20 05:28:0665ASH_EXPORT void PinWindow(aura::Window* window, bool trusted);
hidehiko066b6f72016-06-16 12:29:1066
yorkelee74669cb2017-03-30 22:22:0767// Indicates that the window should autohide the shelf when it is the active
68// window.
69ASH_EXPORT void SetAutoHideShelf(aura::Window* window, bool autohide);
70
mswc30c2772017-02-16 20:08:1771// 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.
73ASH_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.org6bda9632013-04-06 10:33:3776// already in the same root window. Returns true if |window| was moved.
77ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window,
stevenjb@chromium.org0419d722013-04-05 16:16:0878 const ui::Event& event);
79
oshima@chromium.org1ca79d42014-07-18 16:26:1080// Mark the container window so that InstallSnapLayoutManagerToContainers
81// installs the SnapToPixelLayoutManager.
82ASH_EXPORT void SetSnapsChildrenToPhysicalPixelBoundary(
83 aura::Window* container);
84
skycd9d4ae2017-05-25 19:38:3385// Convenience for window->delegate()->GetNonClientComponent(location) that
86// returns HTNOWHERE if window->delegate() is null.
87ASH_EXPORT int GetNonClientComponent(aura::Window* window,
88 const gfx::Point& location);
89
varkha515b43462017-05-26 23:21:2790// When set, the child windows should get a slightly larger hit region to make
91// resizing easier.
92ASH_EXPORT void SetChildrenUseExtendedHitRegionForWindow(aura::Window* window);
varkha515b43462017-05-26 23:21:2793
varkhaae5decc2017-05-26 20:05:3894// Requests the |window| to close and destroy itself. This is intended to
95// forward to an associated widget.
96ASH_EXPORT void CloseWidgetForWindow(aura::Window* window);
97
varkhac8621dd2017-05-31 19:09:0198// Installs a resize handler on the window that makes it easier to resize
Evan Stade60e12fc2018-09-18 21:18:2299// the window.
varkhac8621dd2017-05-31 19:09:01100ASH_EXPORT void InstallResizeHandleWindowTargeterForWindow(
Evan Stade60e12fc2018-09-18 21:18:22101 aura::Window* window);
varkhac8621dd2017-05-31 19:09:01102
Xiaoqian Dai82d99192018-05-25 18:51:35103// Returns true if |window| is currently in tab-dragging process.
104ASH_EXPORT bool IsDraggingTabs(const aura::Window* window);
105
Sammie Quon1c2052a2018-11-29 01:20:24106// Returns true if |window| should be excluded from the cycle list and/or
107// overview.
108ASH_EXPORT bool ShouldExcludeForBothCycleListAndOverview(
109 const aura::Window* window);
110ASH_EXPORT bool ShouldExcludeForCycleList(const aura::Window* window);
111ASH_EXPORT bool ShouldExcludeForOverview(const aura::Window* window);
112
Sammie Quon171bbc72018-11-30 02:58:54113// 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.
116ASH_EXPORT void RemoveTransientDescendants(
117 std::vector<aura::Window*>* out_window_list);
118
tfarina@chromium.org70a2c842012-02-28 23:46:02119} // namespace wm
ben@chromium.org55f593352011-12-24 05:42:46120} // namespace ash
ben@chromium.orga4197522011-11-30 23:38:41121
ben@chromium.orga3301dc2011-12-23 16:34:51122#endif // ASH_WM_WINDOW_UTIL_H_