This assumes https://codereview.chromium.org/1909733002 lands, implementing EventObservers.
Assume a client app that has an EventObserver, say to watch for pointer-down events anywhere on the display.
Right now, a pointer-down event that hits a window belonging to that client will be sent to it twice, once via OnEventObserver() (triggering the client's observer code) and once via the usual OnInputEvent(). In most cases this is easy on the client, as the client's observer code can't do normal dispatch actions -- observers can't mark events as handled, so any observer code has to be independent of normal dispatch.
As an optimization it would be better to send such events to the client once, via OnInputEvent(), with a flag that says it also matches an EventObserver. Then the client library could trigger both normal dispatch and observers.
This is a little tricky because events are not guaranteed to have a target, and mus::ws::EventDispatcher can drop events in multiple locations, so we'll need to return information about whether the event actually found a target, and which WindowTree contains that target, and then decide whether to send the event via OnInputEvent() vs. OnEventObserved().
Comment 1 by jamescook@chromium.org
, Apr 25 2016