Commit Graph

667 Commits

Author SHA1 Message Date
Elias Naur ea404bc8fc text: refactor Editor
To prepare for separating drawing from state tracking, refactor
Editor so that only its top level Layout method touches font
parameters and materials.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur ef5cf5b724 op/paint: return ClipOp from Path.End
Instead of adding an implicit ClipOp, return a ClipOp ready to use, freeing the
caller from recording a macro.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur a937a76534 app: rename UpdateEvent to FrameEvent and add Frame field
While "DrawEvent" was too specific (op.Ops contains non-draw events),
"Update" is too vague: it's a common word, and could be misunderstood
to mean update parts of a window, not replace it.

"FrameEvent" is more specific, and is the usual way to refer to immediate
mode drawing.

While we're here, unexport Window.Update and add a Frame function to
FrameEvent, to emphasize that updating the window frame is only
appropriate during the handling of a FrameEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur e49df512f6 app/internal/input: remove event delivery tracking field
The "hadEvents" field of handlerEvents is enough to track event
delivery.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur ff4fa71738 app/internal/input: really reset dropped handlers
First, let the handlers know they're dropping with a cancel event.

Second, reset the grab flag of dropped handlers.

Fixes issues when drag-scrolling and then clicking and another with two nested
drag gestures where the grab flag is kept for the second handler even after it
is pushed out by the first handler grabbing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur a184faa50e app: remove two remaining Wayland references from xkb
Noticed by ~db47h.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-11 15:31:15 +02:00
Elias Naur 163d9037e6 text: fix editBuffer.runeBefore
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-10 15:27:02 +02:00
Elias Naur 71731a613c io/key: add String methods to Modifiers and Event
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-10 11:57:13 +02:00
Elias Naur a21e8bf7e4 README.md: initialize a module before running module commands
Go 1.14 disables the use of `go run` in module mode outside a module,
see https://golang.org/issue/32027.

Suggest initializing a module in the current directory instead; that
enables module mode (in Go 1.13) and enables `go run`.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-10 08:43:48 +02:00
Elias Naur e4b1a46dd2 cmd/gogio: create a temporary signing key if debug.keystore isn't found
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 19:08:28 +02:00
Elias Naur 468731538e cmd/gogio: look for javac in JAVA_HOME if it is not in PATH
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 18:38:05 +02:00
Elias Naur b749c5dd28 cmd/gogio: fix Android toolchain path for Windows 64-bit
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 18:27:09 +02:00
Elias Naur e031d7325c README.md: remove text about the gophers example -token flag
It doesn't belong in a README about Gio.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 17:44:04 +02:00
Elias Naur 25c76cf8a1 example/go.*: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 17:32:02 +02:00
Elias Naur a76de40e9a app: another macOS < 10.12 build fix
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 17:30:31 +02:00
Elias Naur 23c590b9be example/go.*: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 16:54:54 +02:00
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