3111 Commits

Author SHA1 Message Date
Elias Naur 2d96e760d3 ui/layout,ui/text,ui/widget: shorten Widget function names to W
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 15:41:43 +02:00
Elias Naur 3e5e9b2df2 apps/gophers: convert to new explicit layout API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 12:58:02 +02:00
Elias Naur e436dce0e7 ui/layout: make layout API explicit
With layout.Widget a function instead of an interface, the amount
of per-frame garbage can be drastically reduced.

The layout code ends up slightly more explicit.

As a side benefit, the awkward ordering indexing for Flex and Stack
fit nicely into their new explicit Layout methods.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 11:44:17 +02:00
Elias Naur 25ba53ea51 ui/app: (macOS) suppress key shortcuts beeps
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 09:59:20 +02:00
Elias Naur 44e02786c6 README.md: note that todos can now be filed through email
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-15 22:48:05 +02:00
Elias Naur d98f579048 ui/layout: remove unused layout.Interface
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-14 16:02:24 +02:00
Elias Naur a6fc2b6d45 ui/app: round total and cpu times
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 21:41:28 +02:00
Elias Naur 3c9c38947d ui/app: (wasm) don't focus input field on mouse down or touch start
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 21:30:26 +02:00
Elias Naur 32c525f7fd ui/app/internal/gpu: check for GL_EXT_disjoint_timer_query_webgl2
GL_EXT_disjoint_timer_query_webgl2 is the WebGL 2 counterpart to
the WebGL 1 GL_EXT_disjoint_timer_query extension.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 19:50:26 +02:00
Elias Naur 90d2174090 ui/app: take input focus when initializing the HTML canvas element
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 12:49:43 +02:00
Elias Naur 18c74f00af ui/app/internal/gpu: check floating point FBO support
Some devices don't support floating point FBOs even though they
support OpenGL ES 3. Check support by creating a FBO and fail early
if no support is found.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 12:44:47 +02:00
Elias Naur 8f3384ffe4 ui/app/internal/gl: add RENDERER enum value
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-13 09:52:39 +02:00
Elias Naur 379cab92c4 apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 20:24:20 +02:00
Elias Naur c342054dbc ui/app: apply monitorScale to browser DPI
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 20:23:07 +02:00
Elias Naur 1e14540a6f apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 18:07:57 +02:00
Elias Naur 701ceda4d0 ui/gesture,ui/editor: don't focus and show keyboard on touch press
Wait until click for touches.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 18:06:18 +02:00
Elias Naur 530b9b09b2 ui/app/internal/gpu: drop useless timing
It is almost always 0.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 18:00:25 +02:00
Elias Naur 07a5a6547e ui/app: add CPU draw timings
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 17:51:15 +02:00
Elias Naur 84f80711dc apps/gophers: correct inverted logic
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 17:43:23 +02:00
Elias Naur 31bec932d1 apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 17:33:14 +02:00
Elias Naur 1d91555ace apps/gophers: add context cancellation on StagePaused
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 15:11:44 +02:00
Elias Naur e2a1f07b84 ui/app: rename StageVisible and StageInvisible
StageRunning and StagePaused better reflect their use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 14:59:07 +02:00
Elias Naur 4441a3e13e Revert "ui/app,apps: unexport ChangeStage and Stage"
I found a convincing use case: stopping asynchronous activities
while paused. A follow up change will rename the stages and add
an example.

This reverts commit f9840b0963.
2019-05-12 14:47:38 +02:00
Elias Naur af7a0ad293 REEADME.md: fix typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 14:49:37 +02:00
Elias Naur f9840b0963 ui/app,apps: unexport ChangeStage and Stage
I'm not convinced the API is right. For exmaple, an event that
notifies a program when to save its state is both smaller and
might be sufficient.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:50:18 +02:00
Elias Naur 314c79a725 ui/app: fix iOS build
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:49:47 +02:00
Elias Naur 6d690fd343 README.md: add note about webassembly support
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:36:24 +02:00
Elias Naur 1b6a0580a7 apps: go get gioui.org/ui@latest
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:22:13 +02:00
Elias Naur 801ce944f2 apps/gophers/web: add driver files for WebAssembly builds
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:17:57 +02:00
Elias Naur 0397cbb599 ui/app: add basic webassembly/webgl support
It is still slow. And crashy: https://github.com/golang/go/issues/31980.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:17:57 +02:00
Elias Naur f1c87417bd ui/app: split extension string before matching
Avoids false matches for extensions whose names are substrings of
other extensions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:17:57 +02:00
Elias Naur c6863581e0 ui/app/internal/gl: add workaround for broken sRGB FBOs
Safari on macOS don't treat sRGB correctly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-10 17:50:14 +02:00
Elias Naur 51482b6493 ui/app/internal/gpu: move sRGBA feature detection to context
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-10 17:50:06 +02:00
Elias Naur fd9eb029c8 ui/app/internal/gpu: drop opaque texture optimization
It doesn't seem worth the trouble: images must be scanned for
alpha != 1 and GPUs don't like RGB formats. Use RGBA always.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur 871ae34be5 ui/app/internal/gl: move single channel format detection to context
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur f5fa968038 ui/app/internal/gpu: implement OpenGL ES 2 float fbo fallbacks
Also applicable to WebGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur d118bd5a88 ui/app/internal/gpu: introduce caps and context
Enables graceful fallback to OpenGL ES 2 and WebGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur 8df5feeeea ui/app: make opengl objects structs
WebGL use opaque values for object handles, not integers. To ensure
portability, wrap handle types with a struct.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur 2af0f63cfb ui/app/internal/gl: parse WebGL versions
And drop a redundant error message while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:09 +02:00
Elias Naur 2d7fb556a4 ui/test: invalidate Editor layout on scale changes
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:09 +02:00
Elias Naur 350dc19108 ui/app/internal/gl: invalidate the correct fbo in sRGB fallback
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 14:28:43 +02:00
Elias Naur af46b2bf29 cmd/gio: remove NDK r19b Windows workaround vestiges
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 14:28:43 +02:00
Elias Naur 78421b9db9 website: add go-source meta tag to link godoc.org to sr.ht repository
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-05 21:01:41 +02:00
Elias Naur 967484ce3a apps/hello: fix error handling
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-02 17:28:32 +02:00
Elias Naur 20f55a4ad7 all: delete the ui.Op type
It's no longer used.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:27:50 +02:00
Elias Naur 56133632c6 ui/layout: rename simple.go to layout.go
A more appropriate name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:24:20 +02:00
Elias Naur f60906b8e2 apps: go get gioui.org/ui
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:23:17 +02:00
Elias Naur 252e058766 all: serialize ops
Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering

Cons:
- Slightly clumsier API

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:19:34 +02:00
Elias Naur 7b6e1ce35a ui/pointer: simplify hit testing
Serialize the implied tree of layers and handlers into a list
that can be traversed from the end to collect handlers.

This change will make it easier to switch op representation in
a follow-up change.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-26 19:26:59 +02:00
Elias Naur a8bb3c2f14 all: make pointer.Area an interface
With an interface instead of anonymous functions, amending an
area's parameters can be done even after adding it to an OpHandler.

This will be useful when we switch to serialized op lists.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-25 10:02:14 +02:00