liyujie
2025-08-28 b3810562527858a3b3d98ffa6e9c9c5b0f4a9a8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2015 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
library fuchsia.ui.input;
 
// TODO(jeffbrown): Redesign input event representation later.
 
// The input connection service allows a view to receive input events
// such as key presses and pointer movements.
 
// This service can be retrieved from the |View| service provider.
//
// TODO(jeffbrown): Elaborate this.  Particularly need to think about
// how to handle focus and gestures.
[Discoverable]
interface InputConnection {
  // Sets the listener for receiving input events.
  //
  // If |listener| is null, then the previously set listener is removed.
  1: SetEventListener(InputListener? listener);
 
  // Retrieves an |InputMethodEditor| to handle text editing.
  2: GetInputMethodEditor(KeyboardType keyboard_type,
                         InputMethodAction action,
                         TextInputState initial_state,
                         InputMethodEditorClient client,
                         request<InputMethodEditor> editor);
  3: ShowKeyboard();
  4: HideKeyboard();
};
 
// An interface applications may implement to receive events from an
// input connection.
// TODO(MZ-33): This should include hit testing and an input arena.
[Discoverable]
interface InputListener {
  // Called to deliver an input event.
  //
  // The |consumed| result should indicate whether the input event was
  // consumed by the connection.  If |consumed| is false, the system may
  // apply default behavior of its own in response to the event.
  1: OnEvent(InputEvent event) -> (bool consumed);
};