This document explains how mouse events are processed. The first section describes drivers, and subsequent sections work up the software stack.
src/ui/input/lib/hid-input-report/mouse.cc
parses USB Mouse HID input reports and translates them to FIDL sdk/fidl/fuchsia.input.report/mouse
. More details.
Input Pipeline (src/ui/lib/input_pipeline/
) watch_for_devices
and add bindings based on device type to receive input report events and translate to Input Pipeline internal events, then more handlers in Input Pipeline.
MouseBinding
receives sdk/fidl/fuchsia.input.report/
and convert them to mouse_binding::MouseEvent
, then send to handlers in Input Pipeline.
Handlers in Input Pipeline process events in order:
ClickDragHandler
translate events to RelativeMouseEvent
if the event belongs to a click and drag sequence. It improves the disambiguation of click vs. drag events. We may need to revisit this handler when touchpad support is done.PointerMotionScaleHandler
scale the mouse movement based on scale factor. Scale factor is passed to PointerMotionScaleHandler
when created.MouseInjectHandler
update_cursor_renderer
(eg. position, visibility) and converts mouse_binding::MouseEvent
to fuchsia.ui.pointerinjector.PointerSample
and send to Scenic
.MouseInjector
converts fuchsia.ui.pointerinjector.PointerSample
to scenic_impl::input::InternalMouseEvent
.
MouseSourceBase
converts scenic_impl::input::InternalMouseEvent
to fuchsia.ui.pointer.MouseEvent
and send to clients in MouseSourceBase::UpdateStream
.
Most clients listen to fuchsia.ui.pointer.MouseEvent
events. A special case is Carnelian Terminal.
fuchsia.ui.pointer
, like other clients.virtcon
/recovery
), it runs directly on the display driver and reads fuchsia.input.report
from the input driver.ui/events/fuchsia/
.shell/platform/fuchsia/flutter/pointer_delegate.cc
.src/lib/ui/carnelian/src/input/flatland.rs
and src/lib/ui/carnelian/src/input/report.rs
.