Commit Graph

376 Commits

Author SHA1 Message Date
Elias Naur 6c0850ce60 apps/go.mod: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-20 16:26:47 +02:00
Elias Naur cd244f21ab ui/app: (macOS) don't release opengl context
I haven't found a reliable way to re-create the context and redraw
after deminiaturization or app unhide.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-20 16:22:41 +02:00
Elias Naur 05f0c3e22a ui/app: (macOS) destroy the GL context correctly
The NSOpenGLView owns the NSOpenGLContext so we can't just CFRelease
the context. Use [NSOpenGLView releaseGLContext] instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-20 16:11:27 +02:00
Elias Naur 0b6e6c58dd ui/app: return a concrete Queue from Window.Queue
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-20 14:20:59 +02:00
Elias Naur 4a9b6f3007 apps/go.mod: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-19 13:20:54 +02:00
Elias Naur 6b5714d15d ui/app: (macOS) ignore asynchronous redraws to deleted windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-19 13:19:35 +02:00
Elias Naur 7f5393f9be apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-19 01:22:50 +02:00
Elias Naur a140527b08 ui/app: (macOS) serialize access to the views map
The CVDisplayLink used for synchronizing rendering to the display
refresh rate runs on a separate thread from the main thread.
View callbacks must therefore be serialized. Implement that by
introducing a singleton goroutine that owns the view map and runs
incoming commands.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-19 01:18:48 +02:00
Elias Naur a36372a243 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 21:14:22 +02:00
Elias Naur c94315119b ui/app/internal/input: only drop handlers completely when inactive
Delete a redundant loop; dropHandlers already does the required work.

Fixes pointer event issues found after pointer events with no side
effects no longer trigger redraws.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 21:06:06 +02:00
Elias Naur 75891f024c apps/gophers: update to rename Window.Invalidate method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 18:46:34 +02:00
Elias Naur d9d8df989d ui/app: rename Window.Redraw to Invalidate to match ui.InvalidateOp
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 18:45:46 +02:00
Elias Naur 8fc7a316cc apps/gophers: update to renamed ImageOp.Src field
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 16:00:24 +02:00
Elias Naur 84fb7279eb ui/draw: rename ImageOp.Img to Src
To match widget.Image.Src field name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 15:58:11 +02:00
Elias Naur 934aa4fe8d README.md: add shameless plug to Scatter
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 18:57:38 +02:00
Elias Naur fd096e8838 ui/input,ui/layout: update comments
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 14:30:59 +02:00
Elias Naur b4441a8728 ui: reset StackOp in Pop
To enable re-use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 13:53:57 +02:00
Elias Naur 8f0d741d9f apps/gophers: update to StackOp
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 13:51:20 +02:00
Elias Naur 586d33c26e ui: replace PushOp, PopOp with a StackOp
Before this change, there was no guarantee that a PopOp matched
the intended PushOp. With a single stack operation, the client is
forced to match pop with the right push.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 13:49:32 +02:00
Elias Naur f9fda47d25 apps: update to newest macro api
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 13:24:41 +02:00
Elias Naur 94a913a371 ui: move macro recording from Ops to MacroOp
Move the Record and Stop methods from Ops to MacroOp itself.

Before this change, Ops.Stop stopped the recording of the most
recent macro, which could be a different macro than intended.
After this change, there is no such confusion.

As a bonus, the Ops API becomes less cluttered.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 13:21:51 +02:00
Elias Naur ba9ffe846e ui: merge opsData type with Ops
opsData wasn't worth the complexity.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 12:44:23 +02:00
Elias Naur 6947ed9312 ui/app: go fmt
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-16 12:32:39 +02:00
Elias Naur eb9c2896cd ui/layout: round, not truncate, flex sizes in Flex.Flexible
Without proper rounding, a pixel could be left uncovered at the end
of the flex layout.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 21:43:53 +02:00
Elias Naur f32b5fef43 apps/gophers: update to renamed layout.Inset and layout.UniformInset
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 21:12:53 +02:00
Elias Naur 00b9ff603f ui/layout: rename Insets to Inset and EqualInsets to UniformInset
Rename Insets to the verb Inset for consistency with Align.

Uniform is a better description than Equal for the result of
UniformInset.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 21:10:43 +02:00
Elias Naur 5b7b1eb001 apps: upgrade to the block to macro rename
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 20:39:15 +02:00
Elias Naur 3b5fcfe2bb ui: rename block to macro
It is a more precise name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 20:36:17 +02:00
Elias Naur f36070f716 ui/layout: delete Constraints.Expand and Constraints.Loose
They're not (yet) shown their use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 19:29:42 +02:00
Elias Naur a8aa1a9c7e apps: update to newest gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 19:17:14 +02:00
Elias Naur 667670f9c6 ui/layout: delete Constraints.Exact and rename ExactConstraints
Exact was too special and can be expressed with RigidConstraints.

RigidConstraints is a better name ("rigid" was in the comment!)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-15 19:16:11 +02:00
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