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>
To keep the interface slim, remove the helper methods and shorten
the essential method, Pixels, to Px.
Add and use unexported Config implementation in the app package.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The dp and sp units are approximate and mostly used for layout
dimensions that operate in whole pixels. This change alters the
Config methods to return pixels in ints instead of floats, which
results in smoother use for layout and emphasize the inexactness of
the device independent units.
Clients can still access to raw PxPrDp and PxPrSp factors from
Config.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
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>
Split out OpArea from OpHandler to allow stacked areas in a followup.
Replace hit closures with static shapes (rectangles and ellipses) to
avoid allocations. If needed, generic hit functions can be introduced
again later.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering
Cons:
- Slightly clumsier API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With an interface instead of anonymous functions, amending an
area's parameters can be done even after adding it to an OpHandler.
This will be useful when we switch to serialized op lists.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
gioui.org/ui was renamed from gioui.org/ui/ui before the release,
but the import order wasn't changed accordingly.
Signed-off-by: Elias Naur <mail@eliasnaur.com>