Commit Graph

699 Commits

Author SHA1 Message Date
Elias Naur 2e22edbb99 widget/material: remove unused function
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 17:41:32 +02:00
Elias Naur 3a27bcea2e example: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:44:02 +02:00
Elias Naur fc521ec1ff cmd/gogio: update gio version
The path of the supporting Android Java files and iOS header file
moved.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:43:21 +02:00
Elias Naur b30bf3cef8 app/internal/log: extract log setup to separate package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:39:32 +02:00
Elias Naur 10c1b2cb8d app,internal/window: extract native window code to separate package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:39:32 +02:00
Elias Naur 36d1cd90f2 app,io/system: extract system events to separate package
Package app is the only package that depends on native libraries and
Cgo. Minimize its API, thereby minimizing Gio clients' dependency on
it. In the future, a headless, testing or remote "Window" should be
very easy to replace app.Window.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:20:20 +02:00
Elias Naur 641656b307 example/kitchen: use a different color for the disabled button
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 15:08:26 +02:00
Elias Naur 0559393633 widget/material: don't use transparency for disabled buttons
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 15:08:13 +02:00
Elias Naur 4475bf10bf app: disable darwin SIGPIPE workaround from Go 1.14
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 14:21:02 +02:00
Elias Naur 52fedc27a2 app/internal/xkb: extra XKB interface to internal package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 11:50:44 +02:00
Elias Naur 7672c08f46 example: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:29:39 +02:00
Elias Naur 8cd4c2e5de widget/material: use font.Default
And simplify NewTheme to take no arguments.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:23:39 +02:00
Elias Naur 445d85efe0 font/gofont: add Go font convenience package
To use the Go font in a Gio program, import it:

import _ "gioui.org/font/gofont"

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:23:30 +02:00
Elias Naur edf0d8ef99 font/opentype,text/opentype: move package
Opentype parsing, layout and shaping will be used by subpackages to package
font. Move the opentype package accordingly.

Remove the Must helper function; programs will no longer use the opentype
package in the normal case.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:23:30 +02:00
Elias Naur 40822ef26b font: add a central font registry
Package font holds a singleton text.Shaper for general use. Subpackages
call Register to add fonts to the registry.

The intention is that programs can add a typeface by importing a package:

import _ "gioui.org/font/gofont"

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:23:30 +02:00
Elias Naur d33461dd80 text: match Bold weight to CSS, add Variant and Typeface 2019-10-13 18:23:30 +02:00
Elias Naur 481cca5781 text: use the first registered font as the default in Shaper
Before this change, the default font was the one registered with an empty
Typeface.

We're about to use the correct names for fonts, so change Shaper to
fallback to the first registered typeface instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-13 18:23:30 +02:00
Elias Naur 5a82fc9267 example/kitchen: place buttons on the same row
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 16:52:00 +02:00
Elias Naur e1de1ba591 io/pointer: delete Foremost priority
It wasn't used, and it's not clear that it is useful at all in its current
form. For example, a single control with multiple handler keys (say, one for
scrolling and one for clicking) will only receive priority Foremost for one of
them.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 16:31:23 +02:00
Elias Naur 651e31f7e0 cmd/gogio: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 15:42:47 +02:00
Elias Naur 48cf8af2f2 example/kitchen: add example for demonstrating widgets and theming
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 15:39:50 +02:00
Elias Naur 88e58a98b3 example: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 15:39:50 +02:00
Elias Naur abb99eca5c theme/material: add the material theme
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:36:25 +02:00
Elias Naur ff3fc7a24a widget,text: move Label and Editor from text to widget package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur 607d853b58 unit: add Value.Scale method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur d829e56194 gesture: add Active methods to gestures
Active reports whether events are being processed. If not, widgets
can draw themselves as inactive.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur a5b22860ac text: replace Editor.Event with Editor.Event and add Text to SubmitEvent
THe single-stepping Event was done so that SubmitEvents didn't have to
copy the text out if it wasn't needed.

This is a dubious optimization, because SubmitEvents are only generated
when Editor.Submit is true, in which case it is highly likely the user
wants the text.

Furthermore, I expect Editors with Submit enabled to be relatively short,
in the order of a message field in a chat program.

Finally, Editor will need support for undo at some point. Supporting undo
means we can support a lightweight SubmitEvent that points to an older Editor
state.

All in all (1) we gain a simpler Events method, and (2) we can allow the user
to call it before or after Editor.Layout. Before this change any the events were
gone after Layout was called.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur d8e3d1077c text: maintain valid Editor scroll offset
No functional changes.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur bc8ad61b54 text: remove themable properties from Editor and Label
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur dbb62ae0f6 text: remove padding from Editor
Before this change, the Editor computed a suitable padding for itself
from its font and text. Varying the padding according to the particular
font and text doesn't seem worth it and interferes with higher level widgets'
ability to overlay hints and the like on top of the editor.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur f35fe407b3 text: tighten clip bounds for Editor and Label
We're about to remove the extra padding from Editor. To do that, the
clipping must account for text drawing that lie outside the viewport.

With accurate clip bounds, use it for Label as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
Elias Naur bef7c39e4c text: replace Family with Shaper, add Font, Face
There is now a single shaping implementation, Shaper, for all fonts, replacing
Family that only covered a single typeface.

A typeface is identified by a name, where the empty string denotes the
default typeface.

Font is introduced to specify a particular font from the typeface, style,
weight and size.

Face is changed to an interface for a particular layout and shaping method.
The text/shape package is renamed to text/opentype and contains a Face
implementation based on golang.org/x/image/font/sfnt.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:04:34 +02:00
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