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
// 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 dispatcher service allows the component which owns and controls
// a view tree to dispatch input events to the views that it contains.
//
// This service can be retrieved from the |ViewTree| service provider.
//
// TODO(jeffbrown): Elaborate how input devices are registered with the
// dispatcher so that applications can query their capabilities and distinguish
// input coming from multiple sources concurrently.
[Discoverable]
interface InputDispatcher {
  // Dispatches an event through the view tree.  The dispatcher will deliver
  // the event to the appropriate views based on the current state of the
  // tree, such as focus and the structure of the scene graph.
  //
  // The dispatcher expects the stream of events that it receives to be
  // internally consistent.  For example, each pointer down must be matched
  // by a corresponding pointer up.
  //
  // It is an error to supply an inconsistent stream events to the dispatcher;
  // the connection will be closed.
  //
  // TODO(jeffbrown): Is this the right policy?  It would certainly help
  // diagnose faults earlier.
  // TODO(jeffbrown): Decide whether there should be a way to track the
  // progress of input events.  For testing purposes it is often desirable
  // to block the test until a sequence of events have been delivered and
  // handled.  However these same mechanisms have proven to be brittle in
  // the past so it might be better to solve the problem some other way.
  1: DispatchEvent(InputEvent event);
};