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.
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>
We're about to merge the pointer and key event streams in a single
input queue. To do that, we need to simplify Queue.For to just returning
events for the given handler.
First step is the handler active flag.
Dropping handlers that haven't had their events read doesn't seem
worth it. Drop that special case and only determine a handler's activeness
from its presence in the ops list.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Instead of using the most recent area for hit testing a pointer handler,
use the intersection of the areas up until the handler.
Fixes a bug where layout.List children received pointer events in their
clipped areas.
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>
Instead of allocating and constructing a clip path, store path data
directly in op lists. Use separate op lists for cached text layout
paths.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
To prepare support for cached OpBlock to refer to other Ops lists.
The exposure of OpsReader is alleviated by the removal of the Refs
and Data accessors for Ops.
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>
Serialize the implied tree of layers and handlers into a list
that can be traversed from the end to collect handlers.
This change will make it easier to switch op representation in
a follow-up change.
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>