| 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 module mus.mojom; | 5 module mus.mojom; |
| 6 | 6 |
| 7 import "components/mus/public/interfaces/compositor_frame.mojom"; | 7 import "components/mus/public/interfaces/compositor_frame.mojom"; |
| 8 import "components/mus/public/interfaces/cursor.mojom"; | 8 import "components/mus/public/interfaces/cursor.mojom"; |
| 9 import "components/mus/public/interfaces/input_events.mojom"; | 9 import "components/mus/public/interfaces/input_events.mojom"; |
| 10 import "components/mus/public/interfaces/mus_constants.mojom"; | 10 import "components/mus/public/interfaces/mus_constants.mojom"; |
| 11 import "components/mus/public/interfaces/surface_id.mojom"; | 11 import "components/mus/public/interfaces/surface_id.mojom"; |
| 12 import "components/mus/public/interfaces/window_manager.mojom"; | 12 import "components/mus/public/interfaces/window_manager.mojom"; |
| 13 import "components/mus/public/interfaces/window_manager_constants.mojom"; | 13 import "components/mus/public/interfaces/window_manager_constants.mojom"; |
| 14 import "ui/mojo/geometry/geometry.mojom"; | 14 import "ui/mojo/geometry/geometry.mojom"; |
| 15 import "ui/mojo/ime/text_input_state.mojom"; | 15 import "ui/mojo/ime/text_input_state.mojom"; |
| 16 | 16 |
| 17 struct ViewportMetrics { | 17 struct ViewportMetrics { |
| 18 mojo.Size size_in_pixels; | 18 mojo.Size size_in_pixels; |
| 19 // A value of 0 indicates the real value is not yet available. | 19 // A value of 0 indicates the real value is not yet available. |
| 20 float device_pixel_ratio = 0.0; | 20 float device_pixel_ratio = 0.0; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 struct WindowData { | 23 struct WindowData { |
| 24 uint32 parent_id; | 24 uint32 parent_id; |
| 25 uint32 window_id; | 25 uint32 window_id; |
| 26 mojo.Rect bounds; | 26 mojo.Rect bounds; |
| 27 map<string, array<uint8>> properties; | 27 map<string, array<uint8>> properties; |
| 28 // True if this window is visible. The window may not be drawn on screen (see | 28 // True if this window is visible. The window may not be drawn on screen (see |
| 29 // drawn for specifics). | 29 // OnWindowParentDrawnStateChanged() for details). |
| 30 bool visible; | 30 bool visible; |
| 31 // True if this window is drawn on screen. A window is drawn if attached to | |
| 32 // the root and all ancestors (including this window) are visible. | |
| 33 bool drawn; | |
| 34 ViewportMetrics viewport_metrics; | 31 ViewportMetrics viewport_metrics; |
| 35 }; | 32 }; |
| 36 | 33 |
| 37 enum ErrorCode { | 34 enum ErrorCode { |
| 38 NONE, | 35 NONE, |
| 39 VALUE_IN_USE, | 36 VALUE_IN_USE, |
| 40 ILLEGAL_ARGUMENT, | 37 ILLEGAL_ARGUMENT, |
| 41 }; | 38 }; |
| 42 | 39 |
| 43 // Each Window has support for two surfaces. Generally the |DEFAULT| surface | 40 // Each Window has support for two surfaces. Generally the |DEFAULT| surface |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 }; | 245 }; |
| 249 | 246 |
| 250 // Changes to windows are not sent to the connection that originated the | 247 // Changes to windows are not sent to the connection that originated the |
| 251 // change. For example, if connection 1 changes the bounds of a window by | 248 // change. For example, if connection 1 changes the bounds of a window by |
| 252 // calling SetWindowBounds(), connection 1 does not receive | 249 // calling SetWindowBounds(), connection 1 does not receive |
| 253 // OnWindowBoundsChanged(). | 250 // OnWindowBoundsChanged(). |
| 254 interface WindowTreeClient { | 251 interface WindowTreeClient { |
| 255 // Invoked when the client application has been embedded at |root|. | 252 // Invoked when the client application has been embedded at |root|. |
| 256 // See Embed() on WindowTree for more details. |tree| will be a handle back to | 253 // See Embed() on WindowTree for more details. |tree| will be a handle back to |
| 257 // the window manager service, unless the connection is to the root connection | 254 // the window manager service, unless the connection is to the root connection |
| 258 // in which case it will be null. | 255 // in which case it will be null. |parent_drawn| is true if roots parent is |
| 256 // drawn, see OnParentDrawnStateChanged() for details. |
| 259 OnEmbed(uint16 connection_id, | 257 OnEmbed(uint16 connection_id, |
| 260 WindowData root, | 258 WindowData root, |
| 261 WindowTree? tree, | 259 WindowTree? tree, |
| 262 uint32 focused_window); | 260 uint32 focused_window, |
| 261 bool parent_drawn); |
| 263 | 262 |
| 264 // Invoked when the application embedded at |window| is disconnected. In other | 263 // Invoked when the application embedded at |window| is disconnected. In other |
| 265 // words the embedded app closes the connection to the server. This is called | 264 // words the embedded app closes the connection to the server. This is called |
| 266 // on the connection that created |window| as well as any ancestors that have | 265 // on the connection that created |window| as well as any ancestors that have |
| 267 // the embed root policy. | 266 // the embed root policy. |
| 268 OnEmbeddedAppDisconnected(uint32 window); | 267 OnEmbeddedAppDisconnected(uint32 window); |
| 269 | 268 |
| 270 // Sent when another connection is embedded in the Window this connection was | 269 // Sent when another connection is embedded in the Window this connection was |
| 271 // previously embedded in. See Embed() for more information. | 270 // previously embedded in. See Embed() for more information. |
| 272 OnUnembed(uint32 window); | 271 OnUnembed(uint32 window); |
| 273 | 272 |
| 274 // Sent when a window loses capture. | 273 // Sent when a window loses capture. |
| 275 OnLostCapture(uint32 window); | 274 OnLostCapture(uint32 window); |
| 276 | 275 |
| 277 // Called in response to NewTopLevelWindow() successfully completing. | 276 // Called in response to NewTopLevelWindow() successfully completing. |
| 278 OnTopLevelCreated(uint32 change_id, WindowData data); | 277 // |parent_drawn| is true if the parent of the window is drawn, see |
| 278 // OnDrawnStateChanged() for details. |
| 279 OnTopLevelCreated(uint32 change_id, WindowData data, bool parent_drawn); |
| 279 | 280 |
| 280 // Invoked when a window's bounds have changed. | 281 // Invoked when a window's bounds have changed. |
| 281 OnWindowBoundsChanged(uint32 window, | 282 OnWindowBoundsChanged(uint32 window, |
| 282 mojo.Rect old_bounds, | 283 mojo.Rect old_bounds, |
| 283 mojo.Rect new_bounds); | 284 mojo.Rect new_bounds); |
| 284 | 285 |
| 285 OnClientAreaChanged(uint32 window_id, | 286 OnClientAreaChanged(uint32 window_id, |
| 286 mojo.Insets new_client_area, | 287 mojo.Insets new_client_area, |
| 287 array<mojo.Rect> new_additional_client_areas); | 288 array<mojo.Rect> new_additional_client_areas); |
| 288 | 289 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 317 OnWindowReordered(uint32 window_id, | 318 OnWindowReordered(uint32 window_id, |
| 318 uint32 relative_window_id, | 319 uint32 relative_window_id, |
| 319 OrderDirection direction); | 320 OrderDirection direction); |
| 320 | 321 |
| 321 // Invoked when a window is deleted. | 322 // Invoked when a window is deleted. |
| 322 OnWindowDeleted(uint32 window); | 323 OnWindowDeleted(uint32 window); |
| 323 | 324 |
| 324 // Invoked when the visibility of the specified window changes. | 325 // Invoked when the visibility of the specified window changes. |
| 325 OnWindowVisibilityChanged(uint32 window, bool visible); | 326 OnWindowVisibilityChanged(uint32 window, bool visible); |
| 326 | 327 |
| 327 // Invoked when a change to the visibility of |window| or one if it's | 328 // Invoked when the drawn state of |window|'s parent changes. The drawn state |
| 328 // ancestors is done such that the drawn state changes. This is only invoked | 329 // is determined by the visibility of a Window and the Windows ancestors. A |
| 329 // for the top most window of a particular connection. For example, if you | 330 // Window is drawn if all ancestors are visible, not drawn if any ancestor is |
| 330 // have the hierarchy: A -> B1 -> B2 (B2 is a child of B1 and B1 a child of | 331 // hidden. |
| 331 // A), B1/B2 are from connection 2 and A from connection 1 with all windows | |
| 332 // visible and drawn and the visiblity of A changes to false, then connection | |
| 333 // 2 is told the drawn state of B1 has changed (to false), but is not told | |
| 334 // anything about B2 as it's drawn state can be calculated from that of B1. | |
| 335 // | 332 // |
| 336 // NOTE: This is not invoked if OnWindowVisibilityChanged() is invoked. | 333 // The initial drawn state is communicated by way of OnTopLevelCreated() or |
| 337 OnWindowDrawnStateChanged(uint32 window, bool drawn); | 334 // OnEmbed(). |
| 335 // |
| 336 // This function is only called for root Windows as the drawn state of all |
| 337 // other windows can be determined from their parent. |
| 338 OnWindowParentDrawnStateChanged(uint32 window, bool drawn); |
| 338 | 339 |
| 339 // Invoked when a window property is changed. If this change is a removal, | 340 // Invoked when a window property is changed. If this change is a removal, |
| 340 // |new_data| is null. | 341 // |new_data| is null. |
| 341 OnWindowSharedPropertyChanged(uint32 window, | 342 OnWindowSharedPropertyChanged(uint32 window, |
| 342 string name, | 343 string name, |
| 343 array<uint8>? new_data); | 344 array<uint8>? new_data); |
| 344 | 345 |
| 345 // Invoked when an event is targeted at the specified window. The client must | 346 // Invoked when an event is targeted at the specified window. The client must |
| 346 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify | 347 // call WindowTree::OnWindowInputEventAck() with the same |event_id| to notify |
| 347 // that the event has been processed, and with a boolean |handled| to notify | 348 // that the event has been processed, and with a boolean |handled| to notify |
| (...skipping 21 matching lines...) Expand all Loading... |
| 369 // See description of WindowManager for details. | 370 // See description of WindowManager for details. |
| 370 GetWindowManager(associated WindowManager& internal); | 371 GetWindowManager(associated WindowManager& internal); |
| 371 }; | 372 }; |
| 372 | 373 |
| 373 // Mus provides this interface as a way for clients to connect and obtain a | 374 // Mus provides this interface as a way for clients to connect and obtain a |
| 374 // WindowTree handle with a supplied WindowTreeClient handle. The | 375 // WindowTree handle with a supplied WindowTreeClient handle. The |
| 375 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one. | 376 // WindowTreeClient has no roots, use NewTopLevelWindow() to create one. |
| 376 interface WindowTreeFactory { | 377 interface WindowTreeFactory { |
| 377 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client); | 378 CreateWindowTree(WindowTree& tree_request, WindowTreeClient client); |
| 378 }; | 379 }; |
| OLD | NEW |