class Injector
Defined at line 69 of file ../../src/ui/input/lib/injector/injector.h
Class for handling input injection into Scenic.
We register a touch injector with Scenic for each |device_id| added with OnDeviceAdded.
On OnDeviceRemoved we close the touch injector channel only after all pending events have been
delivered.
If a touch injector channel is closed by Scenic, we try to recover by re-establishing the
connection and injecting pending events. To reduce the risk to performance and infinite loops
here, we assume the connection is successful, and in the rare case that it's not we drop the
corresponding events and try to again for the next batch.
We reuse the same context, target, viewport and dispatch policy for all
fuchsia::ui::pointerinjector::Device channels, since we assume all devices to represent the same
touchscreen.
Public Methods
void ~Injector ()
Defined at line 89 of file ../../src/ui/input/lib/injector/injector.h
void Injector (const Injector & )
Not copyable or movable. Since internal closures capture |this| it's not safe.
Defined at line 92 of file ../../src/ui/input/lib/injector/injector.h
Injector & operator= (const Injector & )
Defined at line 93 of file ../../src/ui/input/lib/injector/injector.h
void Injector (Injector && )
Defined at line 94 of file ../../src/ui/input/lib/injector/injector.h
Injector & operator= (Injector && )
Defined at line 95 of file ../../src/ui/input/lib/injector/injector.h
bool scene_ready ()
For tests.
Defined at line 108 of file ../../src/ui/input/lib/injector/injector.h
void Injector (sys::ComponentContext * component_context, fuchsia::ui::views::ViewRef context, fuchsia::ui::views::ViewRef target, fuchsia::ui::pointerinjector::DispatchPolicy policy, inspect::Node inspect_node)
|component_context| must be not nullptr and must outlive this object. |context|, |target| and
|policy| are used to configure the injector. Please see |fuchsia.ui.pointerinjector| for full
documentation.
Defined at line 116 of file ../../src/ui/input/lib/injector/injector.cc
void SetViewport (Viewport viewport)
Defined at line 129 of file ../../src/ui/input/lib/injector/injector.cc
fuchsia::ui::pointerinjector::Viewport GetCurrentViewport ()
Defined at line 291 of file ../../src/ui/input/lib/injector/injector.cc
void OnDeviceAdded (uint32_t device_id)
Defined at line 154 of file ../../src/ui/input/lib/injector/injector.cc
void OnDeviceRemoved (uint32_t device_id)
Defined at line 160 of file ../../src/ui/input/lib/injector/injector.cc
void OnEvent (const fuchsia::ui::input::InputEvent & event)
Both the API for injecting into RootPresenter and the API for injecting into Scenic support
vector-based reporting of contemporaneous events, but DeviceState doesn't support vector
passthrough, so injection into Scenic may not be aligned on timestamp boundaries.
Defined at line 231 of file ../../src/ui/input/lib/injector/injector.cc
void MarkSceneReady ()
To be called when the scene is ready for injection.
All events are buffered until this is called to prevent test flakiness.
Defined at line 365 of file ../../src/ui/input/lib/injector/injector.cc
Protected Methods
void Injector ()
For mocks.
Defined at line 127 of file ../../src/ui/input/lib/injector/injector.cc