Commit Graph

1704 Commits

Author SHA1 Message Date
Elias Naur 74cee277ca .builds: clarify missing sign-off error message
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 21:35:18 +01:00
Elias Naur cb075ea9cf app/headless,internal/rendertest: relax tests
The Mesa software OpenGL implementation strays enough from the
reference values that tests fail. Relax the tests to make them
pass again.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 20:48:30 +01:00
Elias Naur e0a8202aa0 .builds: enable headless OpenGL tests on linux
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 20:35:28 +01:00
Elias Naur fac1d00c89 app/internal/egl: support EGL_KHR_no_config_context
The mesa surfaceless renderer doesn't support configs, but does
support EGL_KHR_no_config_context so no config is required. Don't
fail context creation in this setup.

With this change, the headless tests work on a headless linux with the
EGL_PLATFORM environment variable set to "surfaceless".

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 20:31:04 +01:00
Walter Werner SCHNEIDER fd2d96adfc all: fix spelling errors
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 08:55:23 +01:00
Walter Werner SCHNEIDER 83d23ab507 all: sort and group imports
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2020-12-17 08:55:09 +01:00
Egon Elbre e383e6d6be widget/material: better disabled color calculation
Use desaturation in combination with alpha multiplication.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-16 19:15:17 +01:00
Robin Eklind 9cc90d9695 cmd/gogio: sort and group imports using goimports
find gio/ -type f -name '*.go' | xargs -I '{}' goimports -w '{}'

Signed-off-by: Robin Eklind
2020-12-16 02:09:44 +01:00
Robin Eklind f3ce6ad29a app/internal/window: fix golint issues
app/internal/window/os_wayland.go:1448:12: gioui.org/io/system.StageEvent composite literal uses unkeyed fields
	app/internal/window/os_x11.go:183:12: gioui.org/io/system.StageEvent composite literal uses unkeyed fields

Signed-off-by: Robin Eklind
2020-12-16 02:09:39 +01:00
pierre 578c226278 io/pointer: CursorNameOp no longer needs an InputOp with Leave and Enter events
Signed-off-by: pierre <pierre.curto@gmail.com>
2020-12-15 18:11:48 +01:00
pierre 36b9019649 widget: added example for Clickable
Signed-off-by: pierre <pierre.curto@gmail.com>
2020-12-15 13:39:18 +01:00
Chris Waldon eb719eaa54 ci: configure automatic mirroring to GitHub
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-12-14 23:56:54 +01:00
Elias Naur 5839e3e8d5 app/internal/window: don't use C.BOOL
Apparently, darwin/arm64 cgo doesn't match the types of YES and BOOL:

os_macos.go:235:40: cannot use _Ciconst_YES (type untyped int) as type _Ctype__Bool

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-14 23:40:29 +01:00
Elias Naur f3ab8d6368 README.md: change GitHub mirror location
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-14 23:29:14 +01:00
Inkeliz fe844cc489 cmd/gogio: fix support for older browsers
That change removes the "??" operator, it isn't supported
by old browsers [0].

[0]: https://caniuse.com/mdn-javascript_operators_nullish_coalescing

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-14 16:33:56 +01:00
Egon Elbre 296303210f widget/material: remove padding from Slider
Remove padding from the sides of the Slider to align them with
other components.

However, since sliders still need to be used with fingers try to
enforce a minimum finger height, if there is sufficient room.
The sides don't need similar treatment since after grabbing it's
possible to move the finger beyond the touch area, without losing
interaction.

To not enforce finger size, the theme can be adjusted:

    theme.FingerSize = unit.Px(0)

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-14 15:56:56 +01:00
Sebastien Binet 8e7066ecd7 font/opentype: fix typo
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-12-14 15:52:39 +01:00
Inkeliz 745bb949bb cmd/gogio: [wasm] embed .js files
Similar to the Android, which includes all .jar files into the .apk.
Now, the `gogio -target js` will include all `*_js.js` files
into the resulting `wasm.js`.

That change make possible to adds custom wasm-imports, which might
be used in future versions of Gio.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 20:24:34 +01:00
Inkeliz 0dfb04eb2d app/internal/window: [windows] add icon support
That change adds the icon to the "window navbar".

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 20:24:33 +01:00
Egon Elbre bd7bb4d5d2 widget/material: use float32 for progress
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-11 18:28:59 +01:00
Inkeliz fa96e12b6d cmd/gogio: add support for Windows
Now, gogio can build the program for Windows, using the `-target
windows`.

It will build with `-H=windowsgui`, by default. Also, it can compile for
multiple platforms if specified using `-target` (e.g. `-target arm, 386,
amd64`), the executable will have the respective suffix (i.e.
`_386.exe`).

gogio will also attach (any) appicon.png as executable icon resource and
include some information about the file and supported operating system.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 17:00:21 +01:00
Egon Elbre 0b2a2d6c2e {gesture,widget}: expose Dragging
Knowing whether a widget is being interacted with allows to implement
bi-directional updates without feedbacks.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-11 16:44:22 +01:00
Inkeliz b79c2dec79 app/internal/window: [wasm] fix on-screen-keyboard
Previously, the keyboard is open by default, even without any focus.
Now, the keyboard will remain closed, until `.focus()` is called. That
change also prevents the keyboard from reopening immediately after blur.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 16:43:31 +01:00
Elias Naur 5a51f40cf7 LICENSE: tighten license language
"provided under terms" is a better match to the UNLICENSE, which puts
the project in the public domain the fullest extent possible.

This is a wording update, not a change in licesing terms.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-11 16:42:04 +01:00
Elias Naur 2dce8a0155 internal/unsafe: fix vet warnings about SliceHeader use
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-10 18:33:02 +01:00
Egon Elbre 679bf092cb layout: add Spacer
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-09 17:41:49 +01:00
Sebastien Binet e71bf13c9a gpu,op/clip: implement dashed stroked paths
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-12-09 11:23:13 +01:00
Elias Naur ac14320bec example: delete
Examples now live in the https://git.sr.ht/~eliasnaur/gio-example
repository.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-09 10:39:30 +01:00
Sebastien Binet be89f8b945 all: introduce Outline and Stroke builders
This CL introduces 2 new path builders:
- Outline which takes a PathSpec to be outlined
- Stroke which takes a PathSpec and a stroke style, to stroke a path.

typically, code like this:

  var p clip.Path
  ...
  p.Outline().Add(o)

should be replaced with:

  var p clip.Path
  ...
  clip.Outline{Path: p.End()}.Op().Add(o)

similarly, stroking should be modified from:

  var p clip.Path
  ...
  p.Stroke(width, clip.StrokeStyle{...}).Add(o)

to:

  var p clip.Path
  ...
  clip.Stroke{Path: p.End(), Style: clip.StrokeStyle{Width:...}}.Op().Add(o)

here are tentative 'rf' scripts (see rsc.io/rf for more details):

  ```
  ex {
  	import "gioui.org/op";
  	import "gioui.org/op/clip";

  	var p clip.Path;
  	var o *op.Ops;

  	p.Outline().Add(o) -> clip.Outline{Path:p.End()}.Op().Add(o);
  }

  ex {
  	import "gioui.org/op";
  	import "gioui.org/op/clip";

  	var o *op.Ops;
  	var p clip.Path;
  	var sty clip.StrokeStyle;
  	var width float32;

  	p.Stroke(width, sty).Add(o) ->   \
	    clip.Stroke{                 \
		Path:p.End(),            \
		Style: clip.StrokeStyle{ \
		    Width: width,        \
	    }}.Op().Add(o);
  }
  ```

Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-12-09 09:44:15 +01:00
pierre 7c5bcd3db8 io/pointer: added CursorNameOp
The cursor can now be customized for a given area.

Signed-off-by: pierre <pierre.curto@gmail.com>
2020-12-09 09:38:31 +01:00
Egon Elbre 675e86b8e8 internal/unsafe: fix empty slice
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-12-09 09:36:07 +01:00
Elias Naur b456e987f7 .builds: prepare for splitting out examples in separate repository
The example module is moving to git.sr.ht/~eliasnaur/gio-example.
We still need some main package for testing gogio, so update reference
to use the module path (gioui.org/example).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-08 19:40:57 +01:00
Chris Waldon acc3f704e4 example/{kitchen,tabs,gophers}: update to use material.Palette
Update gioui.org/cmd while here.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-12-06 23:04:52 +01:00
Chris Waldon a87a520ae8 widget/material: manage widget colors with Palette type
This introduces a new material.Palette type that captures the color information
necessary to render a widget. This type is embedded in the material.Theme to
make it easier to swap to a different palette for part of the UI by reassinging
the Palette field.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-12-06 23:02:30 +01:00
Elias Naur 47ba975899 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-06 22:59:51 +01:00
Elias Naur ede632b265 widget: fix Editor and Label clipping
Commit gioui.org/commit/94d242d18c9245 broke Editor and Label clipping,
most visible for single-line Editors. Restore the correct clipping.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-06 22:57:11 +01:00
Elias Naur 9b8e847a05 example,cmd: update gio version
Remove copy/paste from kitchen now that Editor supports it natively.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-06 22:31:43 +01:00
Inkeliz a4d0c3e702 widget: add support for copy/paste in the Editor
The Editor will handle CTRL+C and CTRL+V. The CTRL+V will paste the
content on the Editor, and CTRL+C will copy all the Editor content.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-06 22:21:18 +01:00
Inkeliz a76f816ae9 io/clipboard,app: add WriteOp, ReadOp
Previously, the only way to manipulate the clipboard (read or write) is
using the `app.Window`.

The new `clipboard.ReadOp` and `clipboard.WriteOp`makes possible to
read/write from the widget.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-06 22:15:16 +01:00
Elias Naur 4e2d08c0a6 widget: replace newline with space in single-line Editors; cover SetText
Move the replacing to Editor.prepend to fix SetText, and replace with
space instead of nothing to keep lines separated even in single-line
Editors.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-06 22:15:16 +01:00
pierre 59720a8a58 router: removed unnecessary checks.
Signed-off-by: pierre <pierre.curto@gmail.com>
2020-12-06 21:58:04 +01:00
Inkeliz 2739547c12 internal/glimpl: [wasm] fix WebGL 1 support v2
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-06 21:57:14 +01:00
Inkeliz fb5e2ee9ec app/internal/window: [wasm] add support for StageEvent
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-06 09:12:22 +01:00
Elias Naur 53e0733d20 .builds: test iOS/Android builds of the gioui.org module, not just the example
The kitchen example may not yet refer to the newest version of the gioui.org
module.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-05 14:32:13 +01:00
Elias Naur 2230accd34 cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-05 10:22:59 +01:00
Inkeliz 828f19304b app: move system.ClipboardEvent to its own package
API change. Update your code with gofmt rule and goimports:

gofmt -r "system.ClipboardEvent -> clipboard.Event"
goimports

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-05 10:20:55 +01:00
Walter Werner SCHNEIDER feb93baee0 app/internal/window: use unsafe pointer to array
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2020-12-05 09:46:12 +01:00
Elias Naur e9a75cc22a example/glfw: delete GLFW => Gio OpenGL bridge
It's no longer needed.

Update gophers to latest gio while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-04 20:52:33 +01:00
Elias Naur ffe5ab51a2 gpu/gl: remove OpenGL functions parameter from NewBackend
As a consequence, most API is gone from gpu/gl, and embedding Gio in
foreign frameworks don't need to provide an OpenGL implementation.

The next change simplifies the GLFW embedding example accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-04 20:50:22 +01:00
Elias Naur b8e33bb420 app/internal/glimpl: derive version parameter in Functions.Init
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-04 20:41:34 +01:00