Commit Graph

199 Commits

Author SHA1 Message Date
Elias Naur c73d3b59e6 ui/app: (wayland) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 15:49:29 +02:00
Elias Naur c1e129a87d ui/layout: implement List.Invert for end aligned lists
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-19 19:46:11 +02:00
Elias Naur f474282a31 ui/app: (wayland) avoid excessive key repeats
Wayland requires its clients to handle key repeating themselves.
Our strategy is simple: start a timer on key down and fire key
events at regular intervals until another key event arrives.

However, if the program blocks the event loop while processing a
synchronous event, key repeats might pile up before the stopping
key event is processed.

This change use the timestamp of the stopping key event to only
dispatch the repeats queued up before the stop time.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-19 12:46:59 +02:00
Elias Naur 0e332f8d65 apps/gophers: update to latest gio version and use Modifiers.Contain
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 21:32:44 +02:00
Elias Naur 7354874bb5 ui/text: add submit events to Editor
Add Editor.Text() and fix a reset while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 21:30:19 +02:00
Elias Naur 474b1e8e17 ui/key: add Modifiers.Contain
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 21:10:01 +02:00
Elias Naur 3d1e16c4d2 ui/text: unexport Editor.Command
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 20:26:52 +02:00
Elias Naur e24f19ecba ui/key,ui/app: introduce ModShift modifier
And add desktop implementations.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 20:20:57 +02:00
Elias Naur 535f61fbeb README.md: update mailing list name and fix todo address
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 17:41:41 +02:00
Elias Naur c511858d30 ui/layout: add sanity checks to Insets/Align Begin/End
Would have caught the invalid layout re-use fixed by a recent commit.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-17 17:36:47 +02:00
Elias Naur d67b7eca6c ui/draw,ui/layout: export OpClip
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-17 16:45:49 +02:00
Elias Naur 1765a66fd6 cmd/gophers: fix layout re-use
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-17 16:41:46 +02:00
Elias Naur 067d493e60 apps/gophers/android: delete
With gio -buildmode=exe, we don't need the Android scaffold anymore.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-17 16:39:35 +02:00
Elias Naur 839faf2b7e website: force https and bump to Go 1.12 app engine runtime
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-12 14:38:33 +02:00
Elias Naur d61a717ca8 apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-11 16:46:24 +02:00
Elias Naur 503c417544 ui/app: (android) enable IME dummy mode
We don't have full IME-aware editor yet. Fortunately, the BaseInputConnection
has a "dummy mode" setting to allow us to receive input from the fancier keyboards
without implementing the full IME interface.

Fixes gio#7 (I hope; I tested with SwiftKey that had the same symptoms)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-11 16:35:43 +02:00
Elias Naur 94162f8f24 apps/gophers: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-10 01:27:12 +02:00
Elias Naur 1f809234b8 ui/app/internal/gpu: replace look up texture with calculation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-10 01:18:23 +02:00
Elias Naur 8917cb33bc apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 22:22:43 +02:00
Elias Naur eddc0c948e ui/app/internal/gpu: fix stenciling on the iOS simulator
It seems that the iOS simulator can return NaN from texture2D, so
even though width == 0, the resulting cover is not.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 22:21:25 +02:00
Elias Naur 0138544242 ui/app/internal/gl: fix GetProgramInfoLog and GetShaderInfoLog
I should read the manual more carefully.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 21:19:50 +02:00
Elias Naur d142a8c89d README.md: use example.com instead of gmail.com for example
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 16:37:15 +02:00
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