Commit Graph

128 Commits

Author SHA1 Message Date
Elias Naur 152a30f468 cmd/gogio: bump minimum Android SDK version to 17 (Android 4.2)
The CPU fallback renderer relies on posix_memalign, which was exposed in
Android 4.2. Support for Android 4.1 could be restored by writing
posix_memalign outselves, but this change is easier.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-26 16:43:29 +02:00
Elias Naur 060ae1cdf9 all: add //go:build lines
They're automatically added by Go 1.17 source formatters. This change
adds them all now.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-26 15:17:51 +02:00
Elias Naur bc7f7f6706 cmd/gogio: enable iPad support
Found by Christophe Meessen.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-06-25 14:44:26 +02:00
Inkeliz 1842b61935 cmd/gogio: [wasm] add favicon and title support
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-06-07 17:10:21 +02:00
Elias Naur 217f3f4de6 cmd/gogio: dump child program outputs to test log
Without logging, a failing child result in nondescript errors such as

windows_test.go:126: exit status 2

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-28 16:18:47 +02:00
Inkeliz b7dc407dbe cmd/gogio: [android] add support for AAB
That patch makes possible to generate Android App Bundle (`.aab`) instead
of APK. In order to generate AAB use `-o outputfile.aab`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-03-25 08:19:41 +01:00
Elias Naur a50a0db3a2 cmd/gogio: bump screenshot retry timeout
Hoping to fix Wayland flakes:

 TestEndToEnd/X11_using_go_import_path: e2e_test.go:102: starting driver and gio app
    TestEndToEnd/Wayland: e2e_test.go:113: retrying after 200ms
    TestEndToEnd/Wayland: e2e_test.go:113: retrying after 400ms
    TestEndToEnd/Wayland: e2e_test.go:113: last error: encountered 12 color mismatches:
          5,5   got 0xffffffffffff, want 0xdedeadadbebe
        395,5   got 0xffffffffffff, want 0xdedeadadbebe
          5,295 got 0xffffffffffff, want 0xdedeadadbebe
        395,295 got 0xffffffffffff, want 0xdedeadadbebe
          5,305 got 0xffffffffffff, want 0x000000000000
        395,305 got 0xffffffffffff, want 0x000000000000
          5,595 got 0xffffffffffff, want 0x000000000000
        395,595 got 0xffffffffffff, want 0x000000000000
        405,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        405,595 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,595 got 0xffffffffffff, want 0xbbbbbbbbbbbb

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-14 11:51:51 +01:00
Peter Sanford 2aa1cc8112 Add new permission: networkstate
For android this provides ACCESS_NETWORK_STATE

Signed-off-by: Peter Sanford <psanford@sanford.io>
2021-03-08 08:19:22 +01:00
Elias Naur 7059b6284a app/internal/wm: rename confusing app/internal/window
Package wm (for "window manager") is a better fit for the package, and
distinguishes it from the low-level package windows for the Windows API.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-06 14:28:57 +01:00
Elias Naur 8ff6546285 gpu,gpu/backend: implement generic backend.NewDevice
NewDevice creates a Device given an API, which is the necessary GPU
resources for a backend.

Convert gpu.New to take an API instead of a backend.Device directly.

In turn, this frees us to later unexport the backend package along with
the backend implementations (for now just gioui.org/gpu/gl for OpenGL).
It also allows programs that embed Gio (such as gioui.org/example/glfw)
to freely choose a backend, not just OpenGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-06 14:24:09 +01:00
Elias Naur 57dee8e61a cmd/gogio: bump Wine timeout for window movement
The Windows tests on builds.sr.ht are still flaky:

    TestEndToEnd/Windows: e2e_test.go:130: retrying after 400ms
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 800ms
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 1.6s
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 2s
    TestEndToEnd/Windows: e2e_test.go:130: last error: encountered 6 color mismatches:
	5,5   got 0xffffffffffff, want 0xffff00000000
	395,5   got 0xffffffffffff, want 0xffff00000000
	5,305 got 0xffff00000000, want 0x000000000000
	395,305 got 0xffff00000000, want 0x000000000000
	405,305 got 0xffffffffffff, want 0xffff00000000
	795,305 got 0xffffffffffff, want 0xffff00000000
    TestEndToEnd/Windows: e2e_test.go:130: hit timeout of 4s after 6 tries

Bump the window movement delay in the hope that it helps.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-03 11:15:13 +01:00
Egon Elbre 60db802951 cmd/gogio: fix test work group handling
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2021-02-28 10:18:37 +01:00
Inkeliz 8227f7ab04 cmd/gogio: [android] update target sdk version
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-25 12:44:28 +01:00
Elias Naur 53763a3410 cmd/gogio: raise end-to-end test timeout
Windows tests often flake:

TestEndToEnd/Windows: e2e_test.go:113: last error: encountered 6 color mismatches:
          5,5   got 0xffffffffffff, want 0xdedeadadbebe
        395,5   got 0xffffffffffff, want 0xdedeadadbebe
          5,305 got 0xdedeadadbebe, want 0x000000000000
        395,305 got 0xdedeadadbebe, want 0x000000000000
        405,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb

Bump the timeout as a quick workaround.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-24 12:52:12 +01:00
Inkeliz 212f7809cb cmd/gogio: [android] allow custom signature-key
That change makes possible to provide custom PKCS#12 (JKS/PFX) using `-signkey` and the password with `-signpass`.

By default the gogio will use the `debug.keystore`, if no key is provided.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-24 12:34:43 +01:00
Inkeliz 2a7295750d cmd/gogio: fix icon/resources for Android
Previously that patch, gogio unzip the `link.apk` (generated by AAPT2) to an temporary folder and then compress it again to a new `app.ap_` file.

For some unknown reason, that unzip-then-zip doesn't work. The resources are included but is corrupted in somehow. That PR aims to fix that by avoid the extraction to an temporary folder.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-22 12:10:36 +01:00
Elias Naur ffb56f42b9 cmd/gogio/testdata: always clear background to white
The webassembly port changed to use transparent black to allow content
below Gio to show through. However, the end-to-end tests expect a white
background.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 09:06:24 +01:00
Elias Naur b420fdf096 cmd/gogio: remove obsolete headless chrome workaround
The two listed issues are fixed, and the builders pass with the
workaround removed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 08:46:03 +01:00
Elias Naur d420654dbc cmd/gogio: fix argv passing from URL search fragment to Go program
Fixes the examples on gioui.org/doc/architecture.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 16:51:31 +01:00
Elias Naur 5dd3ce9923 cmd/gogio: [iOS] identify certificates by their SHA-1 fingerprint
Unlike the common name, the fingerprint is almost certainly unique.
Xcode uses the fingerprint as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 13:18:22 +01:00
Inkeliz 07715a8125 cmd/gogio: remove windres dependency
Now, it's possible to compile to Windows (`-target windows`) without
having `windres`. The PNG icon, manifest and version info will be
generated and include using `gogio`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-01-07 09:49:26 +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
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
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
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 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
Walter Werner SCHNEIDER 4f8150cd59 cmd/gogio: add gogio test for go import path
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2020-11-27 09:16:56 +01:00
Elias Naur 9b54892cc4 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>
2020-11-26 11:17:40 +01:00
Inkeliz eaaffa1f3e cmd/gogio: force GOARM=7 to avoid softfloat on Android
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-11-24 19:53:04 +01:00
Egon Elbre 2affb6eaa4 cmd,example: fix uses of color.NRGBA
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-11-19 11:35:26 +01:00
Walter Werner SCHNEIDER 3c739323cb cmd/gogio: group buildInfo related code
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2020-11-12 15:52:35 +01:00
Elias Naur dbc0796d02 cmd/gogio,cmd/gogio/testdata: update Gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-11-06 20:56:54 +01:00
Elias Naur d5bdf0756a cmd/gogio: use GOOS=ios to target iOS with Go 1.16 and newer
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-20 11:46:34 +02:00
Elias Naur e690c14ddc cmd/gogio: lower minimum OpenGL ES to 2.0 on Android
The Fairphone 2 only supports OpenGL ES 2.0, but otherwise seems
capable of running Gio. By lowering the minimum requirement, Gio apps
will be available in the Play Store for Fairphone 2 devices.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-12 15:16:56 +02:00
Sebastien Binet 2f67feafc0 app/permission/camera,cmd/gogio: add support for camera permission
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-09-12 17:32:11 +02:00
Elias Naur 956bb10a0f cmd/gogio: document -minsdk
Tweak documentation a bit while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-09-12 11:53:07 +02:00
Elias Naur 3dea674390 gogio: skip Android tests when no adb is found
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-29 18:10:31 +02:00
axel paulander edef73f580 cmd/gogio: add -icon flag for specifying the app icon file
Before users were limited to only use a appicon.png in the root directory.
Now the user is free to use any png anywhere on the system with the help of the -icon flag.

Signed-off-by: Axel Paulander <axel.paulander@gmail.com>
2020-08-16 10:52:42 +02:00
Elias Naur a063febed9 cmd: use ANDROID_SDK_ROOT instead of ANDROID_HOME
ANDROID_HOME is deprecated and slowly being removed from Android
tools.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-09 18:17:02 +02:00
Elias Naur d97f7f9093 app/internal/window,cmd/gogio: [iOS] export GioViewController
The Gio GioAppDelegate created the GioViewController programmatically.
When using gogio's -buildmode=archive users may want to use a different
method (for example storyboards) but there can only be one app delegate.

Move the GioAppDelegate to gogio's exe buildmode, and export the
GioViewController for embedding use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 15:47:00 +02:00
Elias Naur 5bd0ecea5e cmd/gogio: add -tags flag for supplying extra tags to the build
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-22 20:57:35 +02:00
Elias Naur 342c0da320 cmd/gogio: add ldflags flag for extra flags
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-22 20:50:28 +02:00
Elias Naur 2f984673a2 cmd/gogio: [Android] use correct android.hardware.type.pc feature
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-22 20:49:49 +02:00
Greg Pomerantz 3a542cc80c cmd/gogio: [Android] check $ANDROID_NDK_ROOT
If the Android NDK is not found in a standard location (e.g. you are
on an F-Droid build server), check the $ANDROID_NDK_ROOT environment
variable.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2020-06-22 18:26:32 +02:00
Elias Naur e2f3bbdfc3 cmd/gogio: [Android] disable ChromeOS input emulation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-19 20:07:44 +02:00
Elias Naur c35d81e828 cmd/gogio: mention that Android builds include jar class files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-19 11:17:24 +02:00
Elias Naur d045f492b4 cmd/gogio: [Android] mark GioActivity ready for multi-window configuration changes
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 17:47:50 +02:00
Elias Naur bb8bb504d8 cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-10 11:29:23 +02:00
Elias Naur 81a84d874b example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 23:03:36 +02:00
Gordon Klaus 9d2a6c48d8 io/pointer: add InputOp.Types to specify which types of events to receive
Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
2020-06-03 15:29:12 +02:00