ref: 1a15d7241ac4e58bfc6eb063d267cc692822ec10 gio/ui/input d---------
ui/input: change Queue to return Events one at a time

By returning all events, widgets that might return early from its
event loop might throw away subsequent events. Instead of requiring
those widgets to store the event list, convert input.Queue to step
through the available events one at a time.

Functional revert of 1735d5ced8937ff6f853aa8b01fed3140738c744.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/app: drop Event

input.Event is enough if we stretch "input" to mean both input
devices and other events such as profiling events and system

The pointer and key packages are separate already, so I don't
expanding the meaning is unreasonable.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input,ui/layout: update comments

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input/system: introduce package for system events

And add ProfileOp and ProfileEvent for registering and receiving
profile data.

Remove the Profiling field and Timings method from app.Window.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/pointer: ignore hits to dropped handlers

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: shorten OpReader.Decode for loops

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input: rename Queue to Router and Events to Queue

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input: change Events to return all events at once

Single stepping events only makes sense for widgets with complex
state, e.g. the text.Editor. For the input.Events source, returning
all events in a single Events call is sufficient and more natural
for clients.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/pointer: split AreaOp into RectAreaOp and EllipseAreaOp

Now that the pass through mode is moved into its own PassOp op,
it doesn't make sense to collect all area types into one exported

Add RectAreaOp and EllipseAreaOp for clients; the internal
representation is still a single op. It can be changed later without
breaking clients.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/pointer: simplify pointer pass through

Get rid of the confused LayerOp and the transparent property from
AreaOp. Add an explicit PassOp to specify whether pointer events
pass-through the current area.

Let AreaOp swallow events even when no handlers are active for the
area. That behaviour is less surprising and allow clients to disable
a widget by keeping its areas but leave out its handlers.

Simplify the pointer.HitResult enum to just a bool: hit or no hit.

Finally, simplify the pointer queue by tracking parent areas and
node with indices.
ui/input: hide soft keyboard when focus is lost

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/key: rename TextInputClosed to TextInputClose

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input: keep default focus on earliest focusable

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: change events to have "Event" suffixed, not prefixed

Match the Go error naming convention (FooError).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: rename ops to have Op suffixed, not prefixed

Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/input: support single stepping through events

Change input.Events interface to return one event at a time until
the queue is empty.

Change text.Editor and gestures to match.

Re-add Editor.Submit while we're here; we don't want to enable
submit mode always.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: add package input for merged input

To avoid passing a queue type for each kind of input (pointer, key),
introduce package input for mapping a handler key to all input events.

Future input sources can be added without changes to programs, and
as an added bonus, event ordering is preserved across input sources.

Signed-off-by: Elias Naur <mail@eliasnaur.com>