~eliasnaur/gio

1

Gio News, January 2021

Details
Message ID
<CAFcc3FTeOFa==9CuuRFBpHLVS8VDUJeggvsq3EpXHvmgq1zc3Q@mail.gmail.com>
DKIM signature
pass
Download raw message
Hello everyone!

We're already a month into 2021, and that means an entire month of Gio
improvements!

========
core gio
========

In addition to normal bugfixes and contributions to the core
repository, Elias has been working to improve the functionality for
embedding Gio within other graphics libraries, primarily using
gioui.org/example/glfw. Additionally, Elias has been exploring the use
of SwiftShader to offline-compile our compute shaders to efficient
amd64/arm64 assembly. SwiftShader is a software implementation of the
Vulkan API, and you can learn more about it here:
https://github.com/google/swiftshader

Many people contributed features and fixes to core Gio in January:

- Elias merged the compute renderer backend for Android/Linux. You can
force its use by running a Gio program on those platforms with the
environment variable GIORENDER=forcecompute.
- Larry Clapp implemented text selection in the
{widget,material}.Editor! This was a huge amount of work over a long
time, and it works marvelously.
- The op.{Push,Pop} methods have been renamed to op.{Save,Load}. See
commit d331dd2 for gofmt rules to rewrite your code automatically.
- Elias added an op.DeferOp that allows you to render a widget *after*
the normal render pass. This enables true overlays, as they can
reliably be drawn atop widgets rendered later in the frame.
- The keyboard.{Focus,SoftKeyboard}Ops have been altered to be more
explicit. See commit e70a16c3 for details.
- Pierre Curto fixed many bugs across the codebase and:
  - updated the named cursor support so that you can change the cursor
without moving the mouse.
  - added helpers to layout.Axis to return the length of the
major/cross axis.
  - enabled material.Slider to render vertically.
  - added a field to layout.List.Position to check the number of
visible children in a list.
- Lucas Rodrigues also contributed many improvements:
  - removed the `windres` dependency from `gogio` so that you can
easily generate binaries for the windows target from any other platform.
  - fixed system insets on mobile browsers.
  - locked the wasm frame rate to the display frame rate.
- Egon Elbre added hover states to all of the material widgets.
- I fixed a bug in widget.Border that caused the border to extend
beyond the returned dimensions.

===========
gio-example
===========

The examples module also got some love this month:

- My previous visualization of the barneshut galaxy simulation from
gonum has joined gio-example under the galaxy directory. Thanks to Dan
Kortschak for donating the simulation code under Gio's license.
- The "windows" example is now named "multiwindow" to clarify its
purpose.
- During the migration of examples from gio-extras to the example
repository, Pierre Curto's demo of his table layout was lost in the
shuffle. It is now available again in the x/outlay/table directory.
- The glfw example has seen some updates to better demonstrate
integrating Gio with other GL libraries (as discussed above).

===========
gioui.org/x
===========

The gio-extras project has been moved to the gioui.org/x namespace.
This namespace is a set of official packages (maintained by yours
truly) that extend core Gio. Some of them are expected to join core
once their utility and stability are established. Others (ones that add
many dependencies for a niche use-case) are expected to remain in /x
indefinitely. During this migration several modules were renamed.
Here's a key to the new names:

materials   => gioui.org/x/component
haptic      => gioui.org/x/haptic
scroll      => gioui.org/x/scroll
events      => gioui.org/x/eventx
niotify     => gioui.org/x/notify
colorpicker => gioui.org/x/colorpicker
outlay      => gioui.org/x/outlay
gioprofiler => gioui.org/x/profiling

All of the source code is now in one repository here:

https://git.sr.ht/~whereswaldon/gio-x

Another change is that these packages will now use the Gio official
mailing list for contributions (though they also accept contributions
on the GitHub mirror https://github.com/gioui/gio-x/).

=======================
playground/live-editing
=======================

I have been experimenting with integrating Gio with Yaegi (Yet Another
Elegant Go Interpreter, https://github.com/traefik/yaegi) so that you
can edit parts of your layout code  live. This has two use-cases:

- increasing the iteration speed of developing Gio GUIs,
- and creating a playground for people to try Gio in their browser.

Historically, we haven't had a browser playground because it would
require running the go compiler in the browser *or* it would require us
to provision a server farm to run the builds. Yaegi lets us dodge this
by precompiling most of the program and then only interpreting a single
package at runtime. This appears to work reasonably well in the browser
(for small packages, anyway).

Larry Clapp has been exploring the iteration speed use-case as well. It
would be really handy to be able to achieve something analogous to
stateful hot reload for Gio/Go applications. Larry has successfully
overridden the definition of a layout function at runtime (switching
from a compiled to an interpreted function dynamically). We've hit some
odd snags along the way, but I think there's still a lot of potential
here.

You can find my PoC code here:

https://git.sr.ht/~eliasnaur/gio-example/tree/112655e32697e0e4efdd57e100
6be4f6bc4c8176/item/livedit

You can see a video of it in action here:

https://user-images.githubusercontent.com/2324697/106301108-4e2fce80-622
5-11eb-8038-1d726b3eb269.mp4

Additionally, Andrew Werner explored achieving the same thing using
gomacro (https://github.com/cosmos72/gomacro) as the interpreter (and
replicated my PoC). You can see his gomacro version here:

https://github.com/ajwerner/livedit

The two interpreters have very different runtime performance
characteristics, and I'm excited to experiment further with both of
them.

===========
sponsorship
===========

Elias and I would like to thank Plato for sponsoring Gio development!
Check out their website here: https://www.platoapp.com/

Additionally, a hearty thanks to Lucas Rodrigues (@inkeliz) for
sponsoring Elias!

If Gio provides value to you, please consider sponsoring one or more of
its developers/maintainers!

Elias Naur:
https://github.com/sponsors/eliasnaur

Chris Waldon:
https://github.com/sponsors/whereswaldon
https://liberapay.com/whereswaldon

======================
call for presentations
======================

If you'd like to present any of your Gio-related work during the
February Gio community call, please reach out to me.

You can find recordings of previous Gio community calls here:

https://www.youtube.com/channel/UCzuKUnKK5gAFJKNyA1imIHw

=======
the end
=======

Thanks for reading! Please reach out if you'd like your work included
in future newsletters.

Cheers,
Chris Waldon
Details
Message ID
<C8Y0Z5KRJW80.1QIU13WIYZDK6@testmac>
In-Reply-To
<CAFcc3FTeOFa==9CuuRFBpHLVS8VDUJeggvsq3EpXHvmgq1zc3Q@mail.gmail.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Excellent update. Thanks Chris!

Elias
Reply to thread Export thread (mbox)