This is a program that exercises Scenic's input subsystem. It directly talks to Scenic, and runs without the help of a root presenter. Other presenters should be disabled while this program runs.
You should see two Views, one vended by direct_input, and an inset View vended by direct_input_child. The functionality is the same: display a finger tracker for each finger on the touchscreen, and “blink” when a keyboard input is received by one of the Views.
Run it like this:
$ run direct_input [--verbose=1]
There are two packages, each containing an independent binary.
Some high-level functionality provided by DirectInput:
To receive InputEvents from Scenic, DirectInput implements the following callback, given to its session as the event handler:
void App::OnSessionEvents(fidl::VectorPtr<fuchsia::ui::scenic::Event> events);
On receipt of an InputEvent from Scenic, we switch based on its type: Focus, Pointer, or Keyboard.
To exercise the multi-View case, DirectInput requests a child program to be launched, and sets up a ViewHolder into which the child can vend its View. DirectInput requests the child to create a View into the provided ViewHolder through the ViewProvider interface, implemented by the child.
DirectInputChild represents a typical user application — e.g., there is no logic to manage input devices and input reports. Instead, it implements the ViewProvider interface (allowing other programs to request we create a View) and sets up its UI logic into its View.
The specifics of how DirectInputChild handles InputEvents are identical to DirectInputChild. However, we deliberately keep the code independent and duplicated so that you can play around with each View independently of the other.