Commit Graph

214 Commits

Author SHA1 Message Date
Elias Naur 7aa7bb3be4 ui: rename ops to have Op suffixed, not prefixed
Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:01:45 +02:00
Elias Naur b981ccf9ed ui/input: support single stepping through events
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>
2019-06-21 16:30:20 +02:00
Elias Naur 893b7f3c9f cmd/gophers,cmd/hello: update to latest API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:18:44 +02:00
Elias Naur 898c3c5d7d ui/layout: unexport List.Update and move its parameters to state
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:17:29 +02:00
Elias Naur d4eb86a9b5 ui/text: replace Editor.Update with Next for stepping through events
Before this change, the Editor cleared its content after each
Submission event. If it didn't multiple submits for a frame would
not result in the cleared text for clients that wants to clear the
Editor between submits.

However, for clients that do not want to clear the content or that
wants to validate the text before accepting it were not supported.

Instead, switch to a event stepping model, where the client can
call Next to receive each EditorEvent (that is, Submit event) in
turn.

We can then delete the Submit flag on Editor and always report Submit
events.

We can also make Layout flush the pending events now that Editor
always has access to its Config and input queue.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:17:29 +02:00
Elias Naur 98d4d926f6 ui/text: move input.Events parameter from Update to Editor state
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:35:45 +02:00
Elias Naur dda9e3486d ui/text: move Config parameter from Editor.Update to Editor state
Assume the user will set a Config pointer once at init.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:27:57 +02:00
Elias Naur a695a115ce ui/measure: rename Faces.Cfg to Config
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:22:30 +02:00
Elias Naur 47c5859d87 ui/app: make Draw.Config a value, not a pointer
We are going to encourage a model where pointers to a central
(program global) Configs are passed to widgets at setup time, and
not pass Configs at every frame.

That way, the global Gonfig can change, but the pointers won't need
updating.

This change only switches the Draw event's Config pointer to a value
to avoid tempting programs to use the event Config instead of
updating their own central Configs.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:02:37 +02:00
Elias Naur b10a6938cd ui/app: update comment and fix typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 14:54:34 +02:00
Elias Naur 173d56a67a ui/app: (ios) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 19:05:06 +02:00
Elias Naur b9205d9965 uis/app: (macos) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 18:45:46 +02:00
Elias Naur a9199c6d23 ui/app: (android) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 16:07:19 +02:00
Elias Naur a92b97e236 ui/app: (js) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 15:55:49 +02:00
Elias Naur 659419738c ui/app: (windows) relay system focus events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-20 15:53:04 +02:00
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