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 1735d5ced8.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
input.Event is enough if we stretch "input" to mean both input
devices and other events such as profiling events and system
commands.
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>
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>
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>
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
type.
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>
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.
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>
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>