Commit Graph

177 Commits

Author SHA1 Message Date
Elias Naur cf99b9b487 README.md: describe how to run programs on iOS simulators
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 16:22:49 +02:00
Elias Naur 62419e05a4 cmd/gio: don't silently skip apk signing if no certificate is found
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 15:59:00 +02:00
Elias Naur 6f9f07e860 apps/gophers: delete support files
Now that the gio tool can generate runnable mobile and webassembly
apps, the support files are no longer needed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 15:43:09 +02:00
Elias Naur 821862b4c6 README.md: use the -buildmode=exe flag for running demos
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 15:41:28 +02:00
Elias Naur aad2fee36e apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 15:21:14 +02:00
Elias Naur 1931582683 ui/app: (wasm) switch from <textarea> to <input> to avoid double newline
With a <textarea> DOM element pressing the enter key will result in
a "Enter" key down event and a "\n" input event. We're only
interested in the key event, so switching to a single line <input>
avoids the extra "\n".

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 15:11:02 +02:00
Elias Naur 441ca835c3 cmd/gio: add -target=js support for creating webassembly packages
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 14:58:00 +02:00
Elias Naur 3c345a67b8 cmd/gio: add iOS/tvOS support for -buildmode=exe
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 14:26:57 +02:00
Elias Naur c3697fd189 cmd/gio: change runCmd to return a trimmed string
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 14:26:57 +02:00
Elias Naur d458070d29 cmd/gio: add buildmode=exe for building gio programs ready to run
And add Android implementation.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 14:26:57 +02:00
Elias Naur 886e9ba68d apps/gophers: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 10:55:43 +02:00
Elias Naur bd005a09e3 ui/app/internal/gpu: upload path data to GPU before re-use
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 18:30:04 +02:00
Elias Naur 108160f502 cmd/gio: update usage documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 11:10:16 +02:00
Elias Naur 52cea80bd4 ui: update doc comment
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 11:00:59 +02:00
Elias Naur 820d26007a apps/gophers: update to merged input queue API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 11:00:59 +02:00
Elias Naur a35118d522 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>
2019-06-08 10:58:57 +02:00
Elias Naur 28dd25736f ui/key: make the computed text input state available as a method
When merging the key and pointers input sources, we can't return
the text input state as a side effect of the Frame method.

Expose it as a method in the key event queue instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-07 20:59:20 +02:00
Elias Naur bb6ee05d95 ui/key: don't drop handlers that haven't had their events read
Similar to the previous change for pointers, only determine the
activeness of a handler from its presence in the ops list.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-07 20:27:22 +02:00
Elias Naur a78f9c6eaa ui/pointer: don't drop handlers that whose events haven't been read
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>
2019-06-07 20:25:32 +02:00
Elias Naur 56bfc6e348 ui/pointer: unexport HitResult enum
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-05 10:53:25 +02:00
Elias Naur f2679b2024 ui/pointer: add Transparent to OpArea to allow events to pass through
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-05 10:51:45 +02:00
Elias Naur b12430bab3 ui/pointer: unexport OpArea.Hit
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-05 10:46:23 +02:00
Elias Naur 13f69a28ac apps/gophers: upgrade to simpler layout API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 16:12:43 +02:00
Elias Naur df791f2e9b ui: remove ui.Ops parameters from layouts and path builder structs
Layouts and path builders are transient and need an ops list for
operation. However, instead of passing the ops list to every method,
pass the list in an init method and store it for subsequent methods.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 16:08:38 +02:00
Elias Naur 60fd129fda apps/gophers: upgrade to OpArea API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 15:24:00 +02:00
Elias Naur 955fe1bc77 ui: make the reference list argument to Ops.Write variadic
Makes the code nicer.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 15:22:11 +02:00
Elias Naur 402837bbfa ui/pointer/queue: intersect hit areas of stacked OpAreas
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>
2019-06-03 15:21:12 +02:00
Elias Naur 40856a244e ui/pointer: introduce OpArea for pointer hit testing
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>
2019-06-03 14:54:26 +02:00
Elias Naur 559db02035 ui: simplify op size and reference count code
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 13:30:18 +02:00
Elias Naur 86f6765e64 ui/app/internal/gl: avoid allocations when passing handles to C
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:51:33 +02:00
Elias Naur 659a85aae0 ui/app/internal/gpu: add specialized path cache to avoid key allocations
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:45:44 +02:00
Elias Naur 34fe872635 apps/gophers: upgrade to latest path clipping API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:36:29 +02:00
Elias Naur 1e38eec0ab ui: build paths as ops
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>
2019-06-02 22:18:04 +02:00
Elias Naur 9f58ed0fea ui: add version to OpBlock to track invalidated blocks
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:37:34 +02:00
Elias Naur a4ccc861ac apps/gophers: switch to explicit drawing state stack
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:37:34 +02:00
Elias Naur 9142345fd4 ui: make OpPush and OpPop explicit
We're about to allow OpBlock for invoking ops from multiple (cached)
Ops containers. To allow for drawing state changes to stick after
invoking such a cached block, we can't let OpBlock perform an implicit
save and restore of drawing state.

Instead, introduce OpPush and OpPop for explicit drawing state stack
management.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:37:34 +02:00
Elias Naur bf5d083b8a ui,ui/internal/ops: store owner Ops in OpBlock
Allows users to refer to other (cached) Ops from a main Ops.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:37:34 +02:00
Elias Naur 9d661277da ui: encapsulate encoded ops in a new type, opsData
Used for making OpBlock refer to other Ops.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 0d2cffe196 ui: let OpsReader keep track of references
Instead of exposing the entire reference slice, return the relevant
references from Next.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 5966aab77e ui: move ops reader to ui package
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>
2019-06-02 19:17:53 +02:00
Elias Naur 528a588f2e apps/hello: update to explicit API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 1c880f2b9d ui/layout: activate sanity checks for Stack
Added by an earlier change, but not activated.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 15:14:46 +02:00
Elias Naur b55a02f597 apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 18:45:35 +02:00
Elias Naur 7ae8fdaae7 ui/app/internal/gpu: track image and color in a state stack
Just like the other drawing state, the current image or color must
be tracked in a stack.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 18:43:51 +02:00
Elias Naur d752040f17 ui/draw: typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 18:21:58 +02:00
Elias Naur 16a55850cb apps/gophers: switch to new OpImage, OpColor, OpDraw API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 13:05:32 +02:00
Elias Naur 00a87f542d ui: introduce OpColor, a specialized OpImage for uniform colors
To avoid allocating an image.Image for OpImage.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 13:01:51 +02:00
Elias Naur 0061c73a89 ui: split OpImage into OpImage and OpDraw
In preparation for an OpColor (and future OpGradient and similar).

Label and Editor no longer take an explicit source image. They
draw with the current image.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 12:44:49 +02:00
Elias Naur 29993af408 apps/gophers: add per-frame mallocs to profiling status line
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-31 14:41:05 +02:00
Elias Naur bb0f80902f apps/gophers: update event method names
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-30 21:57:43 +02:00