OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 module mus.mojom; | |
6 | |
7 import "components/mus/public/interfaces/cursor.mojom"; | |
8 import "components/mus/public/interfaces/event_matcher.mojom"; | |
9 import "components/mus/public/interfaces/window_manager_constants.mojom"; | |
10 import "components/mus/public/interfaces/window_tree_constants.mojom"; | |
11 import "ui/events/mojo/event.mojom"; | |
12 import "ui/gfx/geometry/mojo/geometry.mojom"; | |
13 | |
14 // WindowManager is used when a WindowTreeClient attempts to modify | |
15 // a property of the embed root. When this happens WindowTree calls the | |
16 // appropriate function on WindowManager. For example, if a | |
17 // WindowTreeClient calls SetWindowBounds() on its embed root, WindowTree | |
18 // calls WmSetBounds(). WindowManager can then decide if it wants to | |
19 // change the bounds or not. | |
20 // | |
21 // This interface is only used as an associated interface and is associated | |
22 // with WindowTreeClient, further WindowTree requests this interface from | |
23 // WindowTreeClient supplied at the time the WindowTreeHost is created. | |
24 interface WindowManager { | |
25 // Whether the window is always on top. Type: bool. | |
26 const string kAlwaysOnTop_Property = "prop:always_on_top"; | |
27 // Initial bounds to create the window at. If empty the WindowManager decides | |
28 // the initial bounds. | |
29 const string kInitialBounds_Property = "prop:initial_bounds"; | |
30 // Internal window name. Useful for debugging. Type: mojom::String | |
31 const string kName_Property = "prop:name"; | |
32 // The window's preferred size as defined by its content. Type: gfx::Size. | |
33 const string kPreferredSize_Property = "prop:preferred-size"; | |
34 // The window's resize behavior. Type: ResizeBehavior. | |
35 const string kResizeBehavior_Property = "prop:resize-behavior"; | |
36 // Bounds the window is restored to. Type: gfx::Rect. | |
37 const string kRestoreBounds_Property = "prop:restore-bounds"; | |
38 // Shadow style for the window. Type: mojom::ShadowStyle. | |
39 const string kShadowStyle_Property = "prop:shadow-style"; | |
40 // The window's show state. Type: ShowState. | |
41 const string kShowState_Property = "prop:show-state"; | |
42 // The window bounds as set by user input. Type: gfx::Rect. | |
43 const string kUserSetBounds_Property = "prop:user-set-bounds"; | |
44 // The window's app icon. Type: SkBitmap | |
45 const string kWindowAppIcon_Property = "prop:window-app-icon"; | |
46 // The window type. Type: mojom::WindowType | |
47 const string kWindowType_Property = "prop:window-type"; | |
48 // The window's title. Type: mojom::String | |
49 const string kWindowTitle_Property = "prop:window-title"; | |
50 // A flag controlling the window's presence on the mash shelf. Type: bool | |
51 const string kWindowIgnoredByShelf_Property = "prop:window-ignored-by-shelf"; | |
52 // The application ID (eg. 'mojo:foo'). Type: mojom::String | |
53 const string kAppID_Property = "prop:app-id"; | |
54 // Specifies that the system default caption and icon should not be rendered, | |
55 // and the client area should be equivalent to the window area. Type: bool | |
56 const string kRemoveStandardFrame_Property = "prop:remove-standard-frame"; | |
57 | |
58 // Called immediately when the WindowManager is obtained. | |
59 OnConnect(uint16 client_id); | |
60 | |
61 // Called when a new display is added. |root| gives the root window specific | |
62 // to this WindowManager for |display|. | |
63 WmNewDisplayAdded(Display display, WindowData root, bool parent_drawn); | |
64 | |
65 // When the WindowManager completes a request it must call back to | |
66 // WindowManagerClient::WmResponse(). | |
67 WmSetBounds(uint32 change_id, uint32 window_id, gfx.mojom.Rect bounds); | |
68 WmSetProperty(uint32 change_id, | |
69 uint32 window_id, | |
70 string name, | |
71 array<uint8>? value); | |
72 | |
73 // Asks the WindowManager to create a new window. | |
74 // |requesting_client_id| is the id of the client issuing the request. This | |
75 // allows the window manager to track top level windows by client. | |
76 WmCreateTopLevelWindow(uint32 change_id, | |
77 uint16 requesting_client_id, | |
78 map<string, array<uint8>> properties); | |
79 | |
80 // A WindowTreeClient is considered "janky" by Mus when it stops ACK'ing input | |
81 // events within a reasonable timeframe. When a client enters or exits this | |
82 // state, Mus will tell the window manager about it so that the window manager | |
83 // can update the UI for the janky windows. | |
84 WmClientJankinessChanged(uint16 client_id, bool janky); | |
85 | |
86 // An accelerator registered via AddAccelerator() has been triggered. | |
87 OnAccelerator(uint32 id, ui.mojom.Event event); | |
88 }; | |
89 | |
90 // This interface is only used as an associated interface and is associated | |
91 // with WindowTree. | |
92 interface WindowManagerClient { | |
93 // Enables (or disables) child windows of |window_id| to be activated. | |
94 AddActivationParent(uint32 window_id); | |
95 RemoveActivationParent(uint32 window_id); | |
96 | |
97 ActivateNextWindow(); | |
98 | |
99 // Sets the underlay surface offset for the specified window and additional | |
100 // hit area. The underlay surface is drawn at the bounds of the window minus | |
101 // the offset. The hit area is extended from the bounds of the window by | |
102 // |hit_area|. | |
103 SetUnderlaySurfaceOffsetAndExtendedHitArea(uint32 window_id, | |
104 int32 x_offset, | |
105 int32 y_offset, | |
106 gfx.mojom.Insets hit_area); | |
107 | |
108 // Add and remove accelerators. When accelerators are registered the | |
109 // WindowManager receives the event via OnAccelerator() rather than the | |
110 // target window. The id is defined by the client and can be used to more | |
111 // easily identify the accelerator's action. If an accelerator with the same | |
112 // id or the same matcher already exists, then the accelerator is not added. | |
113 // Accelerator ids 1 << 31 and above are reserved for internal use. | |
114 AddAccelerator(uint32 id, EventMatcher matcher) => (bool success); | |
115 RemoveAccelerator(uint32 id); | |
116 | |
117 // The window manager has completed a request with the specific change id. | |
118 WmResponse(uint32 change_id, bool response); | |
119 | |
120 // Calls WindowTreeClient::RequestClose() on the embedded app at the | |
121 // specified window. | |
122 WmRequestClose(uint32 window_id); | |
123 | |
124 // Sets the frame decoration constants of the display the window manager is | |
125 // associated with. | |
126 WmSetFrameDecorationValues(FrameDecorationValues values); | |
127 | |
128 // Sets the cursor that the non-client areas of the window should use. | |
129 WmSetNonClientCursor(uint32 window_id, Cursor cursor_id); | |
130 | |
131 // Response from WmCreateTopLevelWindow() informing the client of the id for | |
132 // the new window. | |
133 OnWmCreatedTopLevelWindow(uint32 change_id, uint32 window_id); | |
134 }; | |
OLD | NEW |