huangcm
2025-08-30 0269911b91ed7e03c24005924cc6423abf245fb8
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
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2017 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;
 
enum KeyboardType {
  TEXT = 0;
  NUMBER = 1;
  PHONE = 2;
  DATETIME = 3;
};
 
enum InputMethodAction {
  UNSPECIFIED = 0;
  NONE = 1;
  GO = 2;
  SEARCH = 3;
  SEND = 4;
  NEXT = 5;
  DONE = 6;
  PREVIOUS = 7;
};
 
// The current text, selection, and composing state for editing a run of text.
struct TextInputState {
  // Current state revision to avoid race conditions.
  uint32 revision;
 
  // The current text being edited.
  string text;
 
  // The range of text that is currently selected.
  TextSelection selection;
 
  // The range of text that is still being composed.
  TextRange composing;
};
 
// A interface for interacting with a text input control.
interface InputMethodEditor {
  1: SetKeyboardType(KeyboardType keyboard_type);
  2: SetState(TextInputState state);
  3: InjectInput(InputEvent event);
 
  // TODO(TEXT-19): remove these in a later change, after PlatformView has been
  // switched over to open/close on the input_connection_ instead.
  4: Show();
  5: Hide();
};
 
// An interface to receive information from |TextInputService|.
interface InputMethodEditorClient {
  1: DidUpdateState(TextInputState state, InputEvent? event);
  2: OnAction(InputMethodAction action);
};