Elias Naur
8eb58ff2eb
ui: support Window.Draw(nil) in OpsReader
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-15 11:42:47 +02:00
Elias Naur
5b3090b128
ui: don't keep references alive in Ops.Reset
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-15 09:09:30 +02:00
Elias Naur
09b5752659
ui/app: use the delayed redraw timer directly in the Window run loop
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 21:58:44 +02:00
Elias Naur
07622a295c
ui/app: replace locking with channels in Window implementation
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 21:58:43 +02:00
Elias Naur
619a90a646
apps/go.mod: update gio dependency
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 19:35:12 +02:00
Elias Naur
587b88d346
ui/app: don't draw or handle events if window is dead
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 19:33:31 +02:00
Elias Naur
26543ba1a5
apps: use DrawEvent.Size instead of Window.Size
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 13:10:42 +02:00
Elias Naur
6e97d65af1
ui/app: delete Window.Size method
...
Clients should use the size from DrawEvent instead.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-14 13:08:34 +02:00
Elias Naur
cde040369c
cmd/gio: use the import path as basis for the output file
...
Before this change `go list <pkg>` was used to sanitize the import
path of the package argument. That doesn't work well for building
Go source files directly:
gio -target android helloworld.go
where `go list helloworld.go` simply returns "command-line-arguments".
A better way is to leave the package path alone, and compute the
output file separately from the import path, as reported by
`go list -f {{.ImportPath}} <pkg>`.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 20:19:25 +02:00
Elias Naur
41990e3275
apps/go.mod: update
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 13:30:38 +02:00
Elias Naur
112368a2e3
ui/app: add a DataDir fallback to Go 1.12
...
o.UserConfigDir is introduced in Go 1.13, which is not released yet.
Add a Go 1.12 stopgab until then.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 13:28:58 +02:00
Elias Naur
4cde5d57d7
ui/app: remove two redundant assignments
...
StagePaused is the zero value now that StateDead is gone.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 13:14:30 +02:00
Elias Naur
e13b9a4990
apps: support DestroyEvent
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 13:14:17 +02:00
Elias Naur
59e92e8233
ui/app: introduce DestroyEvent for ending the event loop
...
Replace the StageDead stage with DestroyEvent dedicated to ending
the event loop and, for premature window closes, the error.
Drop the error return from NewWindow; any errors in window creation
will appear as an immediate DestroyEvent with its Err field set.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-13 13:09:51 +02:00
Elias Naur
8e307b40a6
apps: update to new NewWindow API
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 20:48:24 +02:00
Elias Naur
a3b9c7818f
ui/app: create windows directly
...
Replace CreateWindow with NewWindow that immediately creates a Window
ready to use.
Drop the Windows channel of windows created by the system. For iOS
and Android where the system creates the windows, let them rendezvous
with the window created in the first NewWindow call.
Android is further changed so that destroying and re-creating the
Java Activity simply reconnects with the original Window.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 20:47:29 +02:00
Elias Naur
46cee54dd6
io/app/internal/input: go fmt
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 20:47:29 +02:00
Elias Naur
98e1ef177c
apps/gophers: update system package path
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:56:02 +02:00
Elias Naur
2296393471
ui/system: move package ui/input/system
...
Just like the pointer and key packages.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:54:41 +02:00
Elias Naur
93368253ac
ui/app: delete unused Input type
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:44:19 +02:00
Elias Naur
759fdb2efe
apps/gophers: simplify type switch
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:41:10 +02:00
Elias Naur
1336ca109a
apps/gophers: upgrade to new profiling api
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:37:05 +02:00
Elias Naur
86533ae683
ui/input/system: introduce package for system events
...
And add ProfileOp and ProfileEvent for registering and receiving
profile data.
Remove the Profiling field and Timings method from app.Window.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:31:29 +02:00
Elias Naur
032e9a380e
ui/app,ui/internal/input: move InvalidateOp summary to Router
...
In preparation for extracting more op types in Router.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 15:11:20 +02:00
Elias Naur
c7eb9be9f3
ui/key,ui/pointer: replace Key types with input.Key
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:53:45 +02:00
Elias Naur
25a20af284
ui/app: only schedule a redraw when events are available
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:37:30 +02:00
Elias Naur
ba18817400
ui/app/internal/input: add tracking up updates to handlerEvents
...
In preparation for only redrawing when new events are available.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:34:24 +02:00
Elias Naur
c7fda6d37d
apps/gophers: add explicit redraws
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:08:59 +02:00
Elias Naur
326f78c341
ui/app: don't implicitly redraw for each CommandEvent
...
Redrawing should only be scheduled when some UI state has changed.
Window has no way to know whether a CommandEvent was ignored by
the client, so push the onus to the client to schedule a redraw.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:05:18 +02:00
Elias Naur
343934d3de
apps/gophers: replace own input router with the window's Queue
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 14:02:54 +02:00
Elias Naur
46850653ef
ui/app: unexport Window.SetTextInput
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 13:58:27 +02:00
Elias Naur
cbdda4e9c5
ui/input: move Router and input queues to internal package
...
Now that only app.Window needs the Router, make it unavailable for
clients.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 13:51:00 +02:00
Elias Naur
0d924a1950
ui/app: add input queue to Window
...
I see no point in forcing the client to manage input events. Let's
put it on Window for now.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 13:39:56 +02:00
Elias Naur
b8eca39277
ui/app: comment fix
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 13:32:16 +02:00
Elias Naur
fb9e5ca902
ui/pointer: ignore hits to dropped handlers
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 12:24:31 +02:00
Elias Naur
3a6fda129a
ui: shorten OpReader.Decode for loops
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 11:44:50 +02:00
Dan Kortschak
3c2c404fa9
apps/hello: fix loop variable captured by func literal
...
Signed-off-by: Dan Kortschak <dan@kortschak.io >
2019-07-12 00:45:19 +02:00
Elias Naur
96b52d3493
apps/gophers: upgrade to changed input api
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 00:07:18 +02:00
Elias Naur
a22bcfc88c
ui/input: rename Queue to Router and Events to Queue
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 00:05:56 +02:00
Elias Naur
6a4ba30c96
ui/text: shorten event loop in Editor.Layout
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 00:05:56 +02:00
Elias Naur
37ac75f3bb
ui/gesture: switch Click to return all events
...
Simpler and more ergonomic for clients.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-12 00:05:56 +02:00
Elias Naur
1735d5ced8
ui/input: change Events to return all events at once
...
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 >
2019-07-12 00:05:46 +02:00
Elias Naur
a9d4186bef
apps/gophers: move user list click handling earlier
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 23:33:43 +02:00
Elias Naur
fc7bb79c36
apps/gophers: remove CrossAxisAlignment Stretch values
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 20:15:11 +02:00
Elias Naur
0d49eb3f4b
ui/layout: drop CrossAxisAlignment value Stretch
...
It doesn't carry its own weight; client can just as easily adjust
the Constraints themselves.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 20:13:10 +02:00
Elias Naur
5c3398f33d
apps/gophers: drop MainAxisSize from Flex initializers
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 19:17:16 +02:00
Elias Naur
10ef4576e7
ui/layout: drop Flex.MainAxisSize setting and MainAxisSize type
...
The setting doesn't bear its own weight; it's simpler for the client
to adjust the constraints itself.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 19:15:17 +02:00
Elias Naur
c7e85efc27
ui/layout: ensure that flex weights add to 1
...
Before this change, the weight applied to the space left, not the
total space available after rigid children.
While here, ensure that weight sums > 1 are capped to the available
space.
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 19:06:27 +02:00
Elias Naur
9f394109cb
apps/gophers: update to simpler Flex.Flexible method
...
Signed-off-by: Elias Naur <mail@eliasnaur.com >
2019-07-11 18:46:58 +02:00
Elias Naur
449c2b844a
ui/layout: drop FlexMode
...
The type and argument to Flex.Flexible does not carry its weight;
It is just as easy to expand the constraint directly.
While we're here, rename the flex argument to weight which is clearer.
2019-07-11 18:44:44 +02:00