Commit Graph

1590 Commits

Author SHA1 Message Date
Egon Elbre f00f3a3359 gpu: add linear gradient
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-11-03 15:39:06 +01:00
Elias Naur 0641a34b24 internal/rendertest: lower test tolerances
Egon Elbre pointed out that a difference of 20 means a 10% difference.
Lowering the tolerance to 5 didn't work on my setup; leave it at 10.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-11-03 15:39:06 +01:00
Elias Naur 18869735db example/go.*: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-11-02 19:46:44 +01:00
Elias Naur 38cdd28681 gpu: fix depth buffer corruption on the Fairphone 2
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-11-02 19:44:56 +01:00
Egon Elbre a55302a498 app/internal/window: use keyed fields
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-11-01 17:13:00 +01:00
Josiah Niedrauer 42e568775c io/key: implement key.Release state
Implement key state for the following platforms:
js, wayland, windows, x11.

Unsupported platforms will continue to function as before, sending
key.Press for all key events.

Signed-off-by: Josiah Niedrauer <josiah@niedrauer.com>
2020-11-01 17:13:00 +01:00
Elias Naur ef652f4922 app: move ownership of GPU context to app.Window
The Window creates the context, and should also be responsible for
destroying it.

As a bonus, the wrong release ordering of loop.renderLoop is fixed.
Before this change, the context would be destroyed before the renderer
got a chance to destroy its resources.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-30 16:47:05 +01:00
Elias Naur 3740f89171 app/internal/window: [Windows] properly handle WM_QUIT
First, don't filter on HWND in GetMessage and PeekMessage, lest
thread-specific messages may get lost. See

https://devblogs.microsoft.com/oldnewthing/20050209-00/?p=36493

Second, replace the dead status with the detection of WM_QUIT; it's
what it's there for.

May update gio#168

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-27 17:57:06 +00:00
Elias Naur f9642447ec .builds: fix FreeBSD builders
For some reason, the FreeBSD 12 image doesn't have xorg-vfbserver.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-26 21:34:23 +01:00
Chris Waldon 672555d3d0 widget/material: remove unused fill helper
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-10-22 18:57:55 +02:00
Chris Waldon 3d042093a5 widget/material: update buttons to use new paint Fill API
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-10-22 18:57:52 +02:00
Chris Waldon fc307c1e71 op/paint: add Fill helpers for painting an area with a solid color
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-10-22 18:57:47 +02:00
Chris Waldon 685e0772a3 op/clip: add UniformRRect to create rects with uniform corner radii
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-10-22 18:57:43 +02:00
Chris Waldon 8bdca84c56 op/clip: export Op method of clip shapes
This allows passing the resulting clip.Op types into functions that
draw shapes.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-10-22 18:57:40 +02: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 7a4b48f67b gpu: delete redundant drawOps.reset
Noticed by Steve Lam

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-18 18:22:16 +02:00
Elias Naur 2ddd4f1985 .builds: fix apple builder
The python package is gone, we may not need it and/or Debian installs
python3 by default.

curl is needed for automatically applying patches from the mailing list.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-13 15:31:19 +02:00
Egon Elbre 24d6f3fb65 f32: optimize Affine2D
encode/decode seem to introduce significant overhead. Inline them
manually. It'll make code harder to read, however the performance wins
are significant.

name \ time/op                 before       after        delta
TransformOffset-32             2.64ns ± 0%  0.25ns ± 0%   ~     (p=0.100 n=3+3)
TransformScale-32              2.64ns ± 0%  0.25ns ± 1%   ~     (p=0.100 n=3+3)
TransformRotate-32             2.65ns ± 0%  0.24ns ± 3%   ~     (p=0.100 n=3+3)
TransformTranslateMultiply-32  42.5ns ± 0%  12.9ns ± 0%   ~     (p=0.100 n=3+3)
TransformScaleMultiply-32      42.6ns ± 0%  12.9ns ± 0%   ~     (p=0.100 n=3+3)
TransformMultiply-32           42.2ns ± 0%  12.9ns ± 2%   ~     (p=0.100 n=3+3)

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-10-13 15:14:33 +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
Pierre.Curto f942db9e25 layout: added documentation
Added comment on the use of Dimension.Baseline and Direction.Layout constraint minimum clearing.
Also, renamed the Direction receiver for consistency and removed unnecessary conversions.

Signed-off-by: Pierre.Curto <pierre.curto@gmail.com>
2020-10-11 11:39:30 +02:00
Elias Naur 29740ba593 io/system: note CommandEvent is delivered as a pointer
For gio#163

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-10-05 09:59:49 +02:00
Elias Naur d2e06d9389 widget: update Editor dimensions after input
Fixes gio#162

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-09-29 19:07:15 +02:00
Elias Naur 4bab6fcf32 internal/f32color: add colorspace-correct function for alpha scaling
Package material's ad-hoc mulAlpha didn't take the sRGB color-space
into account, which meant that alpha-scaled colors were subtly wrong.
Introduce f32color.MulAlpha and convert all uses to it.

Thanks to René Post for finding and debugging the issue.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-09-28 09:06:40 +02:00
Elias Naur 679a34b116 app/internal/window: default to X11 on unix systems
Wayland doesn't guarantee the presence of server-side window decorations
(border, close/maximize/minimize buttons), and Gio doesn't have client-side
decorations either (issue #29). The issue is more than a year old, so it's time
to default to X11 to have a good out-of-the-box experience on unix systems.

Updates gio#29

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-09-27 14:29:31 +02:00
Jack Mordaunt ef7b3e75f4 widget: delete whole words with key modifier
Delete entire words with key modifier, ie "ctrl + delete".

Signed-off-by: Jack Mordaunt <jackmordaunt@gmail.com>
2020-09-17 10:50:49 +02:00
Jack Mordaunt d27d1a989e widget: make editor skip words with key modifier
Signed-off-by: Jack Mordaunt <jackmordaunt@gmail.com>
2020-09-17 10:48:05 +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 829ee4559c .builds: remove annotations
They're gone from sr.ht, according to
https://todo.sr.ht/~sircmpwn/git.sr.ht/318#event-47831.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-29 18:27:55 +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
Elias Naur c03dde453c .builds: merge android.yml into linux.yml
sr.ht recently lowered the number of concurrent builders per commit
to 4.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-29 17:50:31 +02:00
Sebastien Binet f2cd504a9f op/clip: smoother implementation of Arc for large angles
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-29 17:36:37 +02:00
Elias Naur 1584f3a64a app/internal/window: [X11] use correct type for setting X properties
32-bit property values are transferred with the C type "long", which
may be 64 bit.

Fixes "invalid atoms" errors from Firefox and Gedit.

While here, add additional clipboard formats to please Gedit.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-28 13:34:10 +02:00
Sebastien Binet d57edbb49d widget/material: use clip.Path.Arc to draw loader
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 15:25:23 +02:00
Sebastien Binet 3fe0f62fa3 op/clip: export Path's current pen position
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 14:46:05 +02:00
Sebastien Binet 7054ba622a op/clip: implement arc path
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 14:46:02 +02:00
aarzilli 4821472ea1 app/internal/xkb: fix events sent when modifier keys are pressed
When modifier keys are active DispatchKey should not send a
key.EditEvent for the key that was pressed. For example when pressing
Ctrl+Alt+e DispatchEvent should not generate a key.EditEvent{Text:"e"}.

Signed-off-by: aarzilli <alessandro.arzilli@gmail.com>
2020-08-25 12:43:53 +02:00
Elias Naur 9543b5f8f3 .builds: add missing dependency
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:42:09 +02:00
Elias Naur 103c6a1911 .builds: replace ANDROID_HOME with ANDROID_SDK_ROOT
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:25:37 +02:00
Elias Naur e214191ff7 gpu: don't validate uniform locations
Sufficiently smart GPU drivers can eliminate unused uniforms across
shader types.

Fixes gio#158

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:22:59 +02:00
Elias Naur 7eff3f561f widget: report Enum.Changed only when actually changed
Fixes gio#159

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 18:49:54 +02:00
Elias Naur d3fffef861 app/internal/egl: adjust alpha bit depth to enable sRGB on some GPUs
On my setup:

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 530 (SKL GT2) (0x1912)
    Version: 20.1.5
    Accelerated: yes
    Video memory: 3072MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2

eglCreateWindowSurface with the sRGB flag fails with EGL_BAD_MATCH.
Bumping the ALPHA_SIZE from 1 to 8 seems to make the driver happy
again.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-20 14:25:50 +02:00
Elias Naur 3bb1450d0d app: release GPU renderer when done with it
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-17 12:14:35 +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 17b5898dd3 go.mod: bump Go version to 1.14
Go 1.15 is out so let's bump the version to 1.14 to sidestep the annoying
webassembly syscall/js change from Go 1.13.

Go 1.13 (and warlier?) will still attempt to build, but when failing to
build a webassembly program the go tool will report the version mismatch.

Fixes gio#156

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-15 11:10:16 +02:00
Elias Naur 6c30c6386c app,app/internal: [Android] replace Window.Do with ViewEvent
An event reporting the most recent Android View attached to the Window is both
simpler to implement and automatically tracks the Activity lifecycle.

The downside is that buggy programs may hold on to a stale references.
Fortunately, JNI references are handles not pointers so the always-on Android
JNI checks will very likely catch stale references on use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-13 14:41:37 +02:00
Elias Naur c3574cdabd widget/material: Make checkbox/radio buttons icon modifiable
Signed-off-by: songpv <pvsong10@icloud.com>
2020-08-10 21:33:20 +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 83673ecb20 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-26 11:03:39 +02:00
Elias Naur 3b95e29183 app/internal/window: [WebAssembly] fix touch event handling
Fixes gio#149

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-26 11:01:30 +02:00