Commit Graph

651 Commits

Author SHA1 Message Date
Elias Naur da5a83d2b2 app: fix more macOS 10.11 build warnings
Furthermore, add -Wno-deprecated-declarations; it is not worth it.

Updated gio#41

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 16:52:29 +02:00
Elias Naur 6bc55d66c2 example/go.mod: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 14:25:09 +02:00
Elias Naur c3a6ab1174 app: fix build on macOS < 10.12
Fixes gio#41

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 14:22:41 +02:00
Elias Naur e9db3801cc cmd/gogio: rename gio* files to main*
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 13:10:58 +02:00
Greg Pomerantz 81814e6fa4 cmd/gogio: add -minversion flag to specify minimum Android platform
Allow the user to specify a minimum supported Android platform
version.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2019-10-07 17:00:24 +02:00
Elias Naur 370ff4bcc9 example/gophers: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-07 12:04:51 +02:00
Elias Naur 4864459291 app: rename WindowOption to Option, and leave out "With" from options
While we're here, replace Height and Width options with just a Size; the value
of separate width and height options is not clear to me.

Finally, leave out the wrapping struct from the Option type, the
function is enough.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-07 12:00:17 +02:00
Elias Naur 38a5717216 README.md: update godoc link
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 17:18:40 +02:00
Elias Naur afeaa247c8 text: fix typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 13:03:19 +02:00
Elias Naur 225c73f012 text: move Label.it to a local variable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 12:29:35 +02:00
Elias Naur 43131b6f57 apps/gophers: use text.Family where *shape.Family is too specific
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 12:15:18 +02:00
Elias Naur ea082c5cca example: rename apps module
The new name emphasize the nature of the programs and won't be
confused with package `app`.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:43:27 +02:00
Elias Naur e7fabcf774 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:23:02 +02:00
Elias Naur 529fd4d307 layout: rename Flex.Flexible to just Flex
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:20:04 +02:00
Elias Naur 8d82a3eaa6 layout: delete Init methods from Flex and Stack
With Context containing all the necessary information, separate
Init methods no longer makes much sense. Delete them and thereby
remove a source of runtime panics.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:17:41 +02:00
Elias Naur bb796ddf37 apps/gophers: clean up font family code
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 23:12:20 +02:00
Elias Naur 1b44594411 text/shape: reduce garbage a bit
The sfnt.Buffer embedded in the opentype type caused instances of
it to escape. Move the buffer to Family to avoid that.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 22:53:37 +02:00
Elias Naur e8ca986a63 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 22:30:20 +02:00
Elias Naur 2097c6475d text/shape: remove Family.Reset by introducing LRU caches
It was easy to forget Family.Reset, and the per-frame caching strategy is
probably too aggressive. Use a static size for the caches and evict
according to a least recently used policy.

Reset is then no longer required, and we can delete it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 22:27:32 +02:00
Elias Naur 0b637f549d text: rename Face to Family and let Face denote a family configuration
While here, rename Family.Path to Shape which a more precise term.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 22:27:32 +02:00
Elias Naur 404a065a0e apps: update gio version to use explicit text sizes
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 11:32:50 +02:00
Elias Naur b4a52d3010 text: make text size implicit
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-05 11:22:26 +02:00
Elias Naur f230036cad text: re-phrase and clarify Label.MaxLines comment
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-04 19:18:05 +02:00
Elias Naur 31e12607d7 op/paint: note that ImageOp caches image contents
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-03 19:26:37 +02:00
Elias Naur f3819d8164 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-03 13:36:51 +02:00
Elias Naur 6dad034b22 op/paint: rename PathBuilder to Path
There was no "Path" to "Build", so let's just use the simpler name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-03 13:35:38 +02:00
Elias Naur 96d3d74cb3 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 23:29:46 +02:00
Elias Naur 07a36d71d9 app: (linux,android) merge EGLNative* types and functions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 23:21:48 +02:00
Elias Naur 2dcbf6fe3c app: confine the eglWindow indirection to the Wayland backend
Only the Wayland backend needs an wl_egl_window between the wl_surface
and EGL. Move code dealing with the indirection to Wayland specific
code.

Then, introduce the eglDriver interface instead of referencing the
native window type directly. This will help when multiple backends are
supported at runtime (e.g. Wayland+X11).

Finally, move the eglDriver implementation methods from GOOS-specific
code to separate EGL-specific files, allowing EGL types to be used
directly instead of unsafe.Pointer and uinptr.

The result is simpler generic EGL code, and easier path towards X11
support.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 23:07:54 +02:00
Elias Naur 32bda106e7 app: (android,ios) fix build
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 22:55:28 +02:00
Elias Naur cf00c89c9f apps/hello: rename context to gtx for consistency
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 19:51:09 +02:00
Elias Naur 1673600ac6 apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 15:36:36 +02:00
Elias Naur e031308172 layout: take a size, not constraints in Context.Reset
Taking a constraint in Reset smells too much of a layout operation,
whereas a size is simpler and only serves to set the context constraints
to something sensible.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 15:35:05 +02:00
Elias Naur b0e7b165b6 apps/gophers: fix test build failure
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 15:26:32 +02:00
Elias Naur 2a1c203863 README.md: link to Gophercon UK presentation recording
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 10:12:12 +02:00
Elias Naur 6bc5ff2479 apps: updates for renamed and moved packages
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 17:00:22 +02:00
Elias Naur 3784ece6dd all: rename package ui to unit
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur 1d3360699e text/shape: move package measure
Text shaping is a common name for what package measure does. Rename
it to "shape" and move it below the text package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur beaec661d2 op/paint: move paint package below the op package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur 8cf35a1f97 op: add package op for operations
Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur eba1b3a95f app,ui: move instructions link to package app documentation
We're about the split up and finally delete package ui. Move the
instructions link to the second most "top-level" package in Gio,
package app.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 15:25:22 +02:00
Elias Naur e7a97bf176 io/event: move event types from package ui to its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 15:18:08 +02:00
Elias Naur 7a259e68f7 io: give event packages a common prefix
Packages that provide support for external events such as pointer, key and
system are only the beginning. Future packages are expected for clipboard
access, drag and drop, gps positions and so on.

To keep the number of top-level packages under control, move such I/O packages
to the new `io` directory.

The `system` package name was the previous solution to keeping the number of
top-level packages under control: I named it `system` instead of the narrower
`profile` because I expected to put all the less common events into it, turning
`system` into a "package util" smell.

With `io`, package system can be renamed to `profile`.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 14:50:55 +02:00
Elias Naur a175f38d19 COPYING: delete
It is redundant with the existence of LICENSE. I don't remember why I added
COPYING in the first place.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 13:38:33 +02:00
Elias Naur 3c65aa61f6 cmd/gogio,ui: fixups after gioui.org module rename
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 13:04:10 +02:00
Elias Naur 049c0b4dcd website: redirect unknown patsh to godoc
With the renamed gioui.org module, any path could be a Gio package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:49:19 +02:00
Elias Naur 962bc36dac apps,cmd: update to renamed gioui.org module
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:41:29 +02:00
Elias Naur 22cd88df9f all: rename the gioui.org/ui module to gioui.org
The "ui" is redundant and stutters.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:37:06 +02:00
Elias Naur ce74bc0cba ui/layout,ui/app: fix tests, go fmt, update comments
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-26 19:15:58 +02:00
Elias Naur bdd6b32711 ui/app/internal/input: schedule an extra frame after event delivery
A program might choose to process events that affect UI state already laid out.
For example, a button click might switch to a completely different UI page, but
the click might be processed during the drawing of the current page.

Avoiding that require either processing events very early during layout or
adding InvalidateOps whenever events are handled late.

Early event processing is awkward and InvalidateOps are easy to forget and
their absence masked by any other cause of redraw.

This change adds an implicit InvalidateOp for each frame where events have been
delivered to the program, allowing late event handling without use of
InvalidateOps.

In the worst case we waste a frame, increasing power use. I hope that future
optimizations will detect and discard the duplicate frame before it reaches
the GPU.

A similar situation applies to the delayed delivery of Editor events, but
since Editor.Layout flushes remaining events, extra InvalidateOps are not
required. Add a comment.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-26 18:58:25 +02:00