~eliasnaur/gio

1

Gio News, December 2019: Gdlv, Headless Windows, Modifier Keys, Android

Details
Message ID
<BYWLTWTU8MFC.1OHQHYPX3TM5A@testmac>
DKIM signature
pass
Download raw message
	gdlv ported to Gio

gdlv, the GUI frontend to the Go debugger recently gained support for Gio in
addition to the existing Shiny backend. Alessandro Arzilli did the work, and
let me know that the Gio backend is now the default on macOS.

	https://github.com/aarzilli/gdlv


	Keyboard modifiers and mouse buttons

The work on gdlv lead to several features and fixes to Gio itself.

Package io/key gained support for the Ctrl, Command (macOS), Alt and Super (PC)
modifier keys. A virtual modifier, ModShortcut, maps to the platform's shortcut
modifer: Command on macOS, Ctrl on all other platforms.

The io/key package reports Events for several new keys, for example the
function keys (F1-F11) and keys activated by the Shift modifier (!, #, ;).

Finally, package io/pointer reports the active modifier keys for Events in the
Modifiers field, allowing Gio programs to tell the difference between clicks
and, say, Ctrl-clicks.

	
	Package app/headless

The app/headless package allows Go programs to convert their UI to a standard
library image.Image. The headless package uses the same rendering code as 
package app's Window so programs can be sure that the results are consistent.

This short program draws a colored backaground to an image:

	sz := image.Point{X: 800, Y: 600}
	w, err := NewWindow(sz.X, sz.Y)
	if err != nil {
		return errors.New("headless rendering not supported")
	}

	var ops op.Ops
	paint.ColorOp{Color: color.RGBA{A: 0xff, R: 0xcc, G: 0xcc}}.Add(&ops)
	paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{
		X: float32(sz.X),
		Y: float32(sz.Y),
	}}}.Add(&ops)

	w.Frame(&ops)

	img, err := w.Screenshot()

Of course, arbitrary complex UIs can be drawn in the same way. The kitchen
example now supports a -screenshot flag for drawing itself to a .png file:

	https://git.sr.ht/~eliasnaur/gio/tree/master/example/kitchen/kitchen.go

Use

	$ go run gioui.org/example/kitchen -screenshot kitchen.png


	gioui.org screenshots and live demos

I plan to use headless package and Gio's support for running in browsers to
enhance the upcoming documentation pages on gioui.org. A small taste of the
possibilities can be seen on the front page,

	https://gioui.org

where a generated screenshot of the kitchen demo can be switched out with
a running version by pressing the "run" button.


	Android integration

Gregory Pomerantz keeps working on improving the Android integration.
The app.Window method RegisterFragment registers a Java Fragment
instance to the Gio Activity host. A Fragment is a convenient and
standard way to track Android lifecycle events and respond to results
from permission requests and requests to the Android SDK and other apps
on a device.

Gregory is working on a password manager,

	https://git.wow.st/gmp/passgo/src/master/cmd/passgo-gui

and a heart rate monitor,

	https://git.wow.st/gmp/hrm


	Notable changes

The syscall/js standard library package was changed in a backwards incompatible
way for Go 1.14. Gio was updated accordingly, but in the process Gio programs no
longer builds with Go 1.13 for WebAssembly. You need a Go version built from tip,
or wait for the  Go 1.14 beta which is due soon.

The volume of contributor patches to the Gio mailing list continues to increase.
To avoid drowning non-patch posts, use the newly created gio-patches
mailing list to send your patches:

	https://lists.sr.ht/~eliasnaur/gio-patches

If you prefer, the sourcehut hosting service recently added support for a web-based
patch submit flow. If you go to the front page of the Gio git repository,

	https://git.sr.ht/~eliasnaur/gio

the "Clone repo to your account" creates a clone of the project that you can push
commits to. From your clone, say

	https://git.sr.ht/~yourusername/gio

the "Prepare a patchset" button allows you to send a commit or list of commits to
the gio-patches mailing list. When prompted, use the address

	~eliasnaur/gio-patches@lists.sr.ht


	New sponsors

This month saw three new sponsors:

	Kale Blankenship (@vcabbage)
	Larry Clapp (@theclapp)
	@anedel

Larry Clapp was one of the very first users and contributors to Gio. He created
the #gioui channel on the Go Slack instance and helped convince me to join it,
despite my reservations to the walled-garden nature of Slack.

If you also find my work useful, please consider sponsoring me on

	https://eliasnaur.com/sponsor

or by reaching out to me directly.

My full-time work on Gio and related open source projects is 100% funded by
donations and sponsorships.
Details
Message ID
<1AE0BD0D-5F69-44D0-A793-AF199FD5E2C6@evereska.org>
In-Reply-To
<BYWLTWTU8MFC.1OHQHYPX3TM5A@testmac> (view parent)
DKIM signature
pass
Download raw message
The rythm of new features is quite impressive. I'm so happy to see so many contributors bring big pieces of logic in Gio.

Happy December everybody!

Tanguy

Le 4 décembre 2019 12:40:35 GMT+01:00, Elias Naur <mail@eliasnaur.com> a écrit :
>	gdlv ported to Gio
>
>gdlv, the GUI frontend to the Go debugger recently gained support for
>Gio in
>addition to the existing Shiny backend. Alessandro Arzilli did the
>work, and
>let me know that the Gio backend is now the default on macOS.
>
>	https://github.com/aarzilli/gdlv
>
>
>	Keyboard modifiers and mouse buttons
>
>The work on gdlv lead to several features and fixes to Gio itself.
>
>Package io/key gained support for the Ctrl, Command (macOS), Alt and
>Super (PC)
>modifier keys. A virtual modifier, ModShortcut, maps to the platform's
>shortcut
>modifer: Command on macOS, Ctrl on all other platforms.
>
>The io/key package reports Events for several new keys, for example the
>function keys (F1-F11) and keys activated by the Shift modifier (!, #,
>;).
>
>Finally, package io/pointer reports the active modifier keys for Events
>in the
>Modifiers field, allowing Gio programs to tell the difference between
>clicks
>and, say, Ctrl-clicks.
>
>	
>	Package app/headless
>
>The app/headless package allows Go programs to convert their UI to a
>standard
>library image.Image. The headless package uses the same rendering code
>as 
>package app's Window so programs can be sure that the results are
>consistent.
>
>This short program draws a colored backaground to an image:
>
>	sz := image.Point{X: 800, Y: 600}
>	w, err := NewWindow(sz.X, sz.Y)
>	if err != nil {
>		return errors.New("headless rendering not supported")
>	}
>
>	var ops op.Ops
>	paint.ColorOp{Color: color.RGBA{A: 0xff, R: 0xcc, G: 0xcc}}.Add(&ops)
>	paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{
>		X: float32(sz.X),
>		Y: float32(sz.Y),
>	}}}.Add(&ops)
>
>	w.Frame(&ops)
>
>	img, err := w.Screenshot()
>
>Of course, arbitrary complex UIs can be drawn in the same way. The
>kitchen
>example now supports a -screenshot flag for drawing itself to a .png
>file:
>
>	https://git.sr.ht/~eliasnaur/gio/tree/master/example/kitchen/kitchen.go
>
>Use
>
>	$ go run gioui.org/example/kitchen -screenshot kitchen.png
>
>
>	gioui.org screenshots and live demos
>
>I plan to use headless package and Gio's support for running in
>browsers to
>enhance the upcoming documentation pages on gioui.org. A small taste of
>the
>possibilities can be seen on the front page,
>
>	https://gioui.org
>
>where a generated screenshot of the kitchen demo can be switched out
>with
>a running version by pressing the "run" button.
>
>
>	Android integration
>
>Gregory Pomerantz keeps working on improving the Android integration.
>The app.Window method RegisterFragment registers a Java Fragment
>instance to the Gio Activity host. A Fragment is a convenient and
>standard way to track Android lifecycle events and respond to results
>from permission requests and requests to the Android SDK and other apps
>on a device.
>
>Gregory is working on a password manager,
>
>	https://git.wow.st/gmp/passgo/src/master/cmd/passgo-gui
>
>and a heart rate monitor,
>
>	https://git.wow.st/gmp/hrm
>
>
>	Notable changes
>
>The syscall/js standard library package was changed in a backwards
>incompatible
>way for Go 1.14. Gio was updated accordingly, but in the process Gio
>programs no
>longer builds with Go 1.13 for WebAssembly. You need a Go version built
>from tip,
>or wait for the  Go 1.14 beta which is due soon.
>
>The volume of contributor patches to the Gio mailing list continues to
>increase.
>To avoid drowning non-patch posts, use the newly created gio-patches
>mailing list to send your patches:
>
>	https://lists.sr.ht/~eliasnaur/gio-patches
>
>If you prefer, the sourcehut hosting service recently added support for
>a web-based
>patch submit flow. If you go to the front page of the Gio git
>repository,
>
>	https://git.sr.ht/~eliasnaur/gio
>
>the "Clone repo to your account" creates a clone of the project that
>you can push
>commits to. From your clone, say
>
>	https://git.sr.ht/~yourusername/gio
>
>the "Prepare a patchset" button allows you to send a commit or list of
>commits to
>the gio-patches mailing list. When prompted, use the address
>
>	~eliasnaur/gio-patches@lists.sr.ht
>
>
>	New sponsors
>
>This month saw three new sponsors:
>
>	Kale Blankenship (@vcabbage)
>	Larry Clapp (@theclapp)
>	@anedel
>
>Larry Clapp was one of the very first users and contributors to Gio. He
>created
>the #gioui channel on the Go Slack instance and helped convince me to
>join it,
>despite my reservations to the walled-garden nature of Slack.
>
>If you also find my work useful, please consider sponsoring me on
>
>	https://eliasnaur.com/sponsor
>
>or by reaching out to me directly.
>
>My full-time work on Gio and related open source projects is 100%
>funded by
>donations and sponsorships.