app/internal/glimpl: [wasm] remove slow getError calls

The removal of getError significantly improves performance on js/wasm:

Opera 72 (w/ AMD Ryzen 3900X): ~12.29ms per frame to ~8.09ms;
Chrome 87 (w/ Snapdragon 435): ~156.34ms per frame to ~94.31ms;

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
app: support horizontal scrolling on Windows and Linux

Fixes #181.

Signed-off-by: pierre <pierre.curto@gmail.com>
4f8150cd — Walter Werner SCHNEIDER 5 days ago
cmd/gogio: add gogio test for go import path

Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
cmd/gogio: restore package path handling

A previous change converted the package argument to gogio to an absolute path.
However, gogio supports all package paths that may appear in Go import statements.
For example, the path "gioui.org/cmd/example/kitchen" should not be converted.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
example/kitchen: add benchmark

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
f32: added Point.In(Rectangle)

Signed-off-by: pierre <pierre.curto@gmail.com>
cmd/gogio: force GOARM=7 to avoid softfloat on Android

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
op/clip: handle zero Cube

Currently this comes up with RRect/Border that has zero corners. It
improves them from ~250ns to ~170ns. While it's possible to check this
in RRect implementation, however it'll slow down calls with non-zero

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
internal/ops: remove some bounds checks

Currently BCE is unable to understand that the accesses in the code are
safe. Added an explicit slice to make the length bounds obvious.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Many operations do not pass refs to Write. Similarly adding
...interface{} requires constructing a slice, which is slow.

This cuts about 100ns from RRect and Border benchmark.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
op/clip: expose LineTo and QuadTo

Using delta position with Line and Quad can drift over successive calls.
Also, in some cases it's much more convenient to use absolute
coordinates rather than relative.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
app/internal/window: add support for system.CommandBack on wasm

To get the `popstate` we need to create a new entry into
the browser history. Then, Gio will handle the "back" and
"forward" of the page.

In some browsers (Chrome 87/Edge 87): The user must
click inside the window/page at least one time. It will not
work if the user leaves the page  (clicking back button)
without interaction with Gio.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
8a3ff4ab — Raffaele Sena 11 days ago
app/internal/window: implement key.Press and key.Release on macOS

Update key.State documentation and add State.String while here. Also
update Event.String to include State.

Signed-off-by: Raffaele Sena <raff367@gmail.com>
app/internal/window: mitigate keyboard issue on WASM iOS

That change mitigates the issue gio#150 and gio#166. The
iOS can only `focus()` as a response to touchstart/click
events. We can't `focus()` at random, without user interaction.

The `w.requestFocus` will try to focus on the next `touchstart`,
which may need some "double click" in some cases. That mitigates
the issue, but doesn't fixes completely, but open the keyboard. (:

I didn't notice any side-effect of that change on Android and on

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
app/internal/window: remove context-menu (right-click) for wasm

The context-menu seems useless. The only action available, on the
context-menu is to "Save image": which gives a black image.

I think it's better to remove it. The right-click still work and still
provide `pointer.Event`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
app/internal/window: fix enter-key for android

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
.builds: add check for missing sign-offs

As suggested by Chris Waldon, this will catch pushes to master and
also during automatic testing of patches sent to the mailing list.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
.builds: add SPDX license header

Signed-off-by: Elias Naur <mail@eliasnaur.com>
.builds: move go fmt check last

The check is important, but shouldn't block the other tests from running.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
cmd,example: fix uses of color.NRGBA

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
all: use color.NRGBA in public API

color.RGBA has two problems with regards to using it.

First the color values need to be premultiplied, whereas most APIs
have non-premultiplied values. This is mainly to preserve color components
with low alpha values.

Second there are two ways to premultiply with sRGB. One is to premultiply
after sRGB conversion, the other is before. This makes using the API more

Using color.NRGBA in sRGB makes it align with CSS.e

Signed-off-by: Egon Elbre <egonelbre@gmail.com>