| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/input_event_constants.mojom"; | 7 import "components/mus/public/interfaces/input_event_constants.mojom"; |
| 8 import "components/mus/public/interfaces/input_event_matcher.mojom"; | |
| 9 import "components/mus/public/interfaces/input_events.mojom"; | |
| 10 import "components/mus/public/interfaces/input_key_codes.mojom"; | 8 import "components/mus/public/interfaces/input_key_codes.mojom"; |
| 11 import "components/mus/public/interfaces/window_tree.mojom"; | 9 import "components/mus/public/interfaces/window_tree.mojom"; |
| 12 import "ui/mojo/geometry/geometry.mojom"; | 10 import "ui/mojo/geometry/geometry.mojom"; |
| 13 | 11 |
| 14 // WindowTreeHost encapsulates a unique underlying platform window, with a tree | 12 // WindowTreeHost encapsulates a unique underlying platform window, with a tree |
| 15 // of windows. | 13 // of windows. |
| 16 interface WindowTreeHost { | 14 interface WindowTreeHost { |
| 17 // Sets the size of the platform window. | 15 // Sets the size of the platform window. |
| 18 SetSize(mojo.Size size); | 16 SetSize(mojo.Size size); |
| 19 | 17 |
| 20 // Sets a title string to be displayed on the platform window. | 18 // Sets a title string to be displayed on the platform window. |
| 21 SetTitle(string title); | 19 SetTitle(string title); |
| 22 | 20 |
| 23 // Add and remove accelerators. When accelerators are registered the | |
| 24 // WindowTreeHostClient receives the event via OnAccelerator() rather than the | |
| 25 // target window. The id is defined by the client and can be used to more | |
| 26 // easily identify the accelerator's action. If an accelerator with the same | |
| 27 // id or the same matcher already exists, then the accelerator is not added, | |
| 28 // and returns false. | |
| 29 AddAccelerator(uint32 id, EventMatcher matcher) => (bool success); | |
| 30 RemoveAccelerator(uint32 id); | |
| 31 | |
| 32 // Enables (or disables) child windows of |window_id| to be activated. | 21 // Enables (or disables) child windows of |window_id| to be activated. |
| 33 AddActivationParent(uint32 window_id); | 22 AddActivationParent(uint32 window_id); |
| 34 RemoveActivationParent(uint32 window_id); | 23 RemoveActivationParent(uint32 window_id); |
| 35 | 24 |
| 36 ActivateNextWindow(); | 25 ActivateNextWindow(); |
| 37 | 26 |
| 38 // Sets the underlay surface offset for the specified window and additional | 27 // Sets the underlay surface offset for the specified window and additional |
| 39 // hit area. The underlay surface is drawn at the bounds of the window minus | 28 // hit area. The underlay surface is drawn at the bounds of the window minus |
| 40 // the offset. The hit area is extended from the bounds of the window by | 29 // the offset. The hit area is extended from the bounds of the window by |
| 41 // |hit_area|. | 30 // |hit_area|. |
| 42 // TODO(sky): pull this into the WindowTree API exposed for the | 31 // TODO(sky): pull this into the WindowTree API exposed for the |
| 43 // windowmanager. | 32 // windowmanager. |
| 44 SetUnderlaySurfaceOffsetAndExtendedHitArea(uint32 window_id, | 33 SetUnderlaySurfaceOffsetAndExtendedHitArea(uint32 window_id, |
| 45 int32 x_offset, | 34 int32 x_offset, |
| 46 int32 y_offset, | 35 int32 y_offset, |
| 47 mojo.Insets hit_area); | 36 mojo.Insets hit_area); |
| 48 }; | 37 }; |
| 49 | 38 |
| 39 // TODO(sky): get rid of this. |
| 50 interface WindowTreeHostClient { | 40 interface WindowTreeHostClient { |
| 51 // An accelerator registered via AddAccelerator() has been triggered. | |
| 52 OnAccelerator(uint32 id, Event event); | |
| 53 }; | 41 }; |
| 54 | 42 |
| 55 interface WindowTreeHostFactory { | 43 interface WindowTreeHostFactory { |
| 56 // Creates a new WindowTreeHost. |tree_client| is queried for the | 44 // Creates a new WindowTreeHost. |tree_client| is queried for the |
| 57 // WindowManager. | 45 // WindowManager. |
| 58 CreateWindowTreeHost(WindowTreeHost& window_tree_host, | 46 CreateWindowTreeHost(WindowTreeHost& window_tree_host, |
| 59 WindowTreeHostClient? host_client, | 47 WindowTreeHostClient? host_client, |
| 60 WindowTreeClient tree_client); | 48 WindowTreeClient tree_client); |
| 61 }; | 49 }; |
| OLD | NEW |