Newsletter, August 2022
Boiling away dependencies

This month one of the biggest changes was Egon Elbre’s work to eliminate many of Gio’s transitive dependencies. He did this by rewriting significant parts of the text segmentation library that we use, as well as figuring out the proper dance to update us to the multi-module version of golang.org/x/exp. The results are a go.sum with 500 fewer lines, and Gio binaries that are 1.5MiB smaller.

Elias is preparing to move from Europe to Central America, and has thus been quite busy. What time he could spend on Gio this month went to patch review and discussion rather than implementing new features. We can expect another relatively quiet month for Elias in September while he settles in to a new continent, but things will return to their old rhythm before too long.

I (Chris) have been working hard on helping Plato Team prepare a Gio-based desktop application for public release. It’s not out yet, but its release will be a major milestone for Gio as a technology. I also reviewed a number of patches bound for Gio-x, configured some cool things in GitHub, and improved the context area component.

GitHub Mirror

Thanks to the prompting of Lucas Rodrigues, I configured two cool things in our GitHub mirror repo. The first is that you can now view all public GitHub-based projects built with Gio here. It’s gratifying to see well over 500 people trying Gio in public. Another way to see projects using Gio (that isn’t bound to just GitHub) is via pkg.go.dev.

Also thanks to a prod from Lucas, I’ve configured the ability to sponsor the gioui GitHub organization. The funds will go to our OpenCollective, and people sponsoring us that way can display their support on their GitHub profiles.

Sponsorship

I’d like to thank Lucas Rodrigues and Denys Smirnov for choosing to support Gio this month! Sponsorship money given to Gio enables Elias and I to cover the costs of running Gio’s infrastructure, to pay for some of our time spent maintaining and improving Gio, and to plan for funding significant feature work. Speaking of significant feature work, keep your eyes on the mailing list. Something in that direction is coming soon.

core gio

Breaking changes by author

The one breaking change in core was the dependency update. It doesn’t change the API, but it changes our minimum Go version to 1.18. If your project’s go.mod declares a lower Go version, you won’t be able to update to the latest Gio. You will instead get errors about ambiguous imports.

Egon Elbre:

  • go.mod,go.sum: bump dependencies. Bump golang/x/exp/shiny to use the specific module, instead of using a single all-encompassing module. This significantly reduces the number of packages in go.sum. 276b7eef

Changes by author:

Elias Naur:

  • app: [macOS/iOS] remove redundant header include. 911b526d
  • app: [Wayland] maintain fallback decoration height during maximize. Window.decorations.height is supposed to be a constant during the lifetime of the window, unlike w.decorations.Config.decoHeight that varies depending on the decorations state (fallback or custom). This change makes that so, fixing a problem where the fallback decorations would fail to offset client content after a maximize or minimize. 3b2f2efa
  • layout: ensure Flex{Alignment: Middle} respects minimum constraint. Before this change, the middle alignment would align according to the widest child. This change aligns according to the widest child or minimum constraint, whichever is largest. 8425d2a6

Chris Waldon:

  • widget: add useful state accessors to scrollbar. This commit adds methods to widget.Scrollbar that enable consuming code to check if the scroll indicator is processing a drag gesture or if the scroll track is currently being hovered. These accessors enable scrollbar style types to have enough information to hide the scroll indicator when it isn’t needed, whereas currently they cannot differentiate between a scrollbar indicator that is being dragged but hasn’t moved since the last frame and a scrollbar indicator that is not being dragged. 020eb27f

gio-x

Breaking changes by author

Dominik Honnef:

  • richtext: [API] allow any value type in metadata. Users may want to associate complex metadata with spans, such as objects that interactive spans refer to. Let users store them directly instead of having to roundtrip through strings. 6e5ccb8

Changes by author

Chris Waldon:

  • component(context-area): use smarter positioning. If the context area is able to fit the contextual widget inside of itself, but the default offsetting from the activation gesture’s position will cause the contextual widget to exceed the boundaries of the context area, the widget will now be displayed on the opposite side of the activating gesture if it can still fit within the context are there. eecc69e
  • component(context-area): add state update method. This commit adds a method to the context area type that permits running the event processing independently of the layout. This is useful for applications that need to know whether the contextual widget will be displayed during the current frame prior to actually performing the display. If this method is never invoked, it will automatically be invoked by Layout. If it has already been invoked during a given frame, it will be skipped by Layout. 1a8b0f4
  • component: add transition detection functions to context area. This commit adds functions to ContextArea enabling the caller to determine if the contextual widget was just activated or dismissed. Previously, you could only determine whether the contextual widget was active, and would need to implement detecting the transition yourself. d941263

Dominik Honnef:

  • richtext: add support for text alignment. a0b26f7

Egon Elbre:

  • go.mod,go.sum: bump dependencies. This updates multiple dependencies getting rid of many unnecessary entries in go.sum. 48391e7

gio-example

I updated gio-example’s base versions of gio and gio-x several times this month in order to pick up the dramatic decrease in dependencies and changes to the public API of gioui.org/x/richtext.

gio-cmd

Elias created a simple code generation utility for converting basic SVGs into Gio functions. You can find it in gioui.org/cmd/svg2gio. If you’re interested in rendering SVGs at runtime, instead check out Lucas Rodrigues’ giosvg project.