~whereswaldon

North Carolina

https://waldon.blog

Freelance engineer working to make portable GUIs easy and pleasant.

I'm one of Gio's two maintainers, and I focus on making the text and widget APIs great.

Some other fun projects:

  • Arbor, a tree-based, decentralizable chat platform
  • gover, an easy way to install and update Go on any *nix system

If you get value out of my work, please consider sponsoring me on Liberapay or GitHub.

I am also available for hire.

Trackers

~whereswaldon/arbor-dev

Last active 13 days ago

~whereswaldon/watt-wise

Last active a month ago

~whereswaldon/gio-extras

Last active 3 years ago

~whereswaldon/pointstar

Last active 4 years ago

~whereswaldon/github-action-replication-testing

Last active 4 years ago

~whereswaldon/Capital-Letters

Last active 4 years ago

~whereswaldon/trellis

Last active 5 years ago

#580 wayland: window.Perform(system.ActionClose) causes panic 4 days ago

Comment by ~whereswaldon on ~eliasnaur/gio

I can also reproduce this trivially with the multiwindow example program (just click the "close" button).

#581 Nested lists rendered by markdown renderer in richtext not formatted correctly 4 days ago

Comment by ~whereswaldon on ~eliasnaur/gio

I'm afraid that the current markdown rendering capability doesn't support nested structures. The real feature gap is in styledtext, which would need to grow some notion of "indentation level" in order to nest elements properly. It's certainly possible to implement it if you'd like to take a stab. I'd happily accept a patch adding support, but I'm not able to implement this myself right now.

#578 [svg2gio] Nothing output for lucide SVGs 18 days ago

Comment by ~whereswaldon on ~eliasnaur/gio

REPORTED RESOLVED CLOSED

#574 Opacity stack interacts strangely with macros a month ago

Ticket created by ~whereswaldon on ~eliasnaur/gio

Walter S provided this example on slack:

// SPDX-License-Identifier: Unlicense OR MIT

package main

import (
	"log"
	"os"

	"gioui.org/layout"
	"gioui.org/op/paint"

	"gioui.org/app"
	"gioui.org/font/gofont"
	"gioui.org/op"
	"gioui.org/text"
	"gioui.org/widget/material"
)

func main() {
	go func() {
		w := new(app.Window)
		if err := loop(w); err != nil {
			log.Fatal(err)
		}
		os.Exit(0)
	}()
	app.Main()
}

func loop(w *app.Window) error {
	th := material.NewTheme()
	th.Shaper = text.NewShaper(text.WithCollection(gofont.Collection()))
	var ops op.Ops
	for {
		switch e := w.Event().(type) {
		case app.DestroyEvent:
			return e.Err
		case app.FrameEvent:
			gtx := app.NewContext(&ops, e)
			layout.Flex{}.Layout(
				gtx,
				layout.Rigid(LeButton{bText: "Hello", mTheme: th}.Layout),
				layout.Rigid(LeButton{bText: "World", mTheme: th}.Layout),
			)
			e.Frame(gtx.Ops)
		}
	}
}

type LeButton struct {
	bText  string
	mTheme *material.Theme
}

func (b LeButton) Layout(gtx layout.Context) layout.Dimensions {
	// Draw label and record macro and dimensions for later.
	labelMacroOp := op.Record(gtx.Ops)
	opacityStack := paint.PushOpacity(gtx.Ops, 1)
	labelDim := material.Body1(b.mTheme, b.bText).Layout(gtx)
	opacityStack.Pop()
	labelCallOp := labelMacroOp.Stop()

	// Offset the label, to make room for the imaginary icon.
	labelCallOp.Add(gtx.Ops)

	return labelDim
}

The text "World" is extremely distorted and partially truncated, even though the use of the macro and opacity stack should have no visual impact.

module foo

go 1.22.2

require gioui.org v0.6.0

require (
        gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 // indirect
        gioui.org/shader v1.0.8 // indirect
        github.com/go-text/typesetting v0.1.1 // indirect
        golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 // indirect
        golang.org/x/exp/shiny v0.0.0-20220827204233-334a2380cb91 // indirect
        golang.org/x/image v0.5.0 // indirect
        golang.org/x/sys v0.5.0 // indirect
        golang.org/x/text v0.9.0 // indirect
)
$ go version
go version go1.22.2 linux/amd64

Linux Wayland (river) AMD open source graphics.

#572 Fwd: Detecting mouse wheel a month ago

Comment by ~whereswaldon on ~eliasnaur/gio

Hmm. I tried making a test program like this:

// SPDX-License-Identifier: Unlicense OR MIT

package main

// A simple Gio program. See https://gioui.org for more information.

import (
	"image"
	"image/color"
	"log"
	"os"

	"gioui.org/app"
	"gioui.org/font/gofont"
	"gioui.org/io/event"
	"gioui.org/io/input"
	"gioui.org/io/pointer"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"gioui.org/text"
	"gioui.org/widget/material"
)

func main() {
	go func() {
		w := app.NewWindow()
		if err := loop(w); err != nil {
			log.Fatal(err)
		}
		os.Exit(0)
	}()
	app.Main()
}

var tag = new(bool)
var c = color.NRGBA{R: 0xff, A: 0xff}

func doButton(ops *op.Ops, q input.Source) {
	// Confine the area of interest to a 100x100 rectangle.
	defer clip.Rect{Max: image.Pt(100, 100)}.Push(ops).Pop()

	// Declare `tag` as being one of the targets.
	event.Op(ops, tag)

	// Process events that arrived between the last frame and this one.
	for {
		ev, ok := q.Event(pointer.Filter{
			Target: tag,
			Kinds:  pointer.Scroll,
			ScrollBounds: image.Rectangle{
				Min: image.Point{
					Y: -100,
				},
				Max: image.Point{
					Y: 100,
				},
			},
		})
		if !ok {
			break
		}

		if x, ok := ev.(pointer.Event); ok {
			switch x.Kind {
			case pointer.Scroll:
				c.G = uint8(x.Scroll.Y/100 + float32(c.G))
			}
		}
	}

	paint.ColorOp{Color: c}.Add(ops)
	paint.PaintOp{}.Add(ops)
}

func loop(w *app.Window) error {
	th := material.NewTheme()
	th.Shaper = text.NewShaper(text.WithCollection(gofont.Collection()))
	var ops op.Ops
	for {
		switch e := w.NextEvent().(type) {
		case app.DestroyEvent:
			return e.Err
		case app.FrameEvent:
			gtx := app.NewContext(&ops, e)
			doButton(gtx.Ops, gtx.Source)
			e.Frame(gtx.Ops)
		}
	}
}

I don't see anything unexpected though. I can scroll up and down to gradually adjust the degree of green in the color. I didn't have to set an X coordinate on the scroll bounds or anything. Jon, does this program work for you?

#22 Investigate crash a month ago

Comment by ~whereswaldon on ~whereswaldon/watt-wise

I think this happens during the load of an energy trace when we haven't yet resized all of these slices because the dataset just got bigger. I've only reproduced this crash during active data loads from disk (where the data is changing very rapidly).

#22 Investigate crash a month ago

Ticket created by ~whereswaldon on ~whereswaldon/watt-wise

panic: runtime error: index out of range [397] with length 397

goroutine 12 [running]:
main.(*ChartData).layoutStackPlot(0xc000882000, {{{0x0, 0x0}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...}, ...)
        /home/chris/Code/wattwise/watt-wiser/chart.go:791 +0x8a6
main.(*ChartData).layoutPlot.func1.1({{{0x0, 0x0}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, {{0x0, ...}, ...}, ...})
        /home/chris/Code/wattwise/watt-wiser/chart.go:505 +0x669
gioui.org/layout.Stack.Layout({0xc4?}, {{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...}, ...)
        /home/chris/Code/go/pkg/mod/gioui.org@v0.5.0/layout/stack.go:60 +0x156
main.(*ChartData).layoutPlot.func1({{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, {{0x0, ...}, ...}, ...})
        /home/chris/Code/wattwise/watt-wiser/chart.go:494 +0x2d9
gioui.org/widget.(*Bool).Layout.func1({{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, {{0x0, ...}, ...}, ...})
        /home/chris/Code/go/pkg/mod/gioui.org@v0.5.0/widget/bool.go:45 +0x1dc
gioui.org/widget.(*Clickable).layout(0xc000882048, {0x869dc0?, 0xc000882040}, {{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, ...}, ...}, ...)
        /home/chris/Code/go/pkg/mod/gioui.org@v0.5.0/widget/button.go:91 +0x139
gioui.org/widget.(*Bool).Layout(0xc000882040, {{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...}, ...)
        /home/chris/Code/go/pkg/mod/gioui.org@v0.5.0/widget/bool.go:42 +0x10f
main.(*ChartData).layoutPlot(0xc000882000, {{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...}, ...)
        /home/chris/Code/wattwise/watt-wiser/chart.go:493 +0x668
main.(*ChartData).Layout.func1(0x12?)
        /home/chris/Code/wattwise/watt-wiser/chart.go:234 +0x531
git.sr.ht/~whereswaldon/watt-wiser/backend.(*RWBox[...]).Read(0x274?, 0x1c?)
        /home/chris/Code/wattwise/watt-wiser/backend/datasource.go:42 +0x84
main.(*ChartData).Layout(0x9?, {{{0x4c1, 0x46c}, {0x4c1, 0x46c}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...}, ...)
        /home/chris/Code/wattwise/watt-wiser/chart.go:201 +0x6d
main.(*UI).layoutMainArea.func3({{{0x4e9, 0x548}, {0x4e9, 0x548}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, {{0x0, ...}, ...}, ...})
        /home/chris/Code/wattwise/watt-wiser/ui.go:159 +0x78
gioui.org/layout.Flex.Layout({0x80?, 0x3a?, 0xd?, 0xc0?}, {{{0x4e9, 0x564}, {0x4e9, 0x564}}, {0x3f800000, 0x3f800000}, ...}, ...)
        /home/chris/Code/go/pkg/mod/gioui.org@v0.5.0/layout/flex.go:134 +0x5f9
main.(*UI).layoutMainArea(0xc000232180, {{{0x4e9, 0x564}, {0x4e9, 0x564}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...})
        /home/chris/Code/wattwise/watt-wiser/ui.go:142 +0x2b4
main.(*UI).Layout(0xc000232180, {{{0x4e9, 0x564}, {0x4e9, 0x564}}, {0x3f800000, 0x3f800000}, {0xc176478ee5becad2, 0xa4cc7ca6, 0xe21d00}, ...})
        /home/chris/Code/wattwise/watt-wiser/ui.go:200 +0x98
main.loop(0xc000288600, {0xc0001721c0?, 0xc00010a870?}, {0xc00016f8c0, 0x17})
        /home/chris/Code/wattwise/watt-wiser/main.go:125 +0x365
main.main.func2.1()
        /home/chris/Code/wattwise/watt-wiser/main.go:82 +0x57
created by main.main.func2 in goroutine 9
        /home/chris/Code/wattwise/watt-wiser/main.go:81 +0x465
exit status 2

#566 A new project started in GIO 2 months ago

Comment by ~whereswaldon on ~eliasnaur/gio

Hello, in the future please direct such posts to the mailing list rather than the issue tracker.

Some of the features you want are already available in gio-x (file pickers in package explorer, some modal dialogs in package component).

As for helping out, you can chat about how to approach specific problems you want to solve on the mailing list or in slack, and you can submit patches either via email or github.

I'm going to mark this as invalid since it isn't a bug report or feature request.

Cheers, Chris

REPORTED RESOLVED INVALID

#564 not enough arguments in call to s.fontMap.AddFace 2 months ago

Comment by ~whereswaldon on ~eliasnaur/gio

We depend upon a specific version of typesetting, and using a different version may not work. You should be able to go get the version in our go.mod to fix your build.

REPORTED RESOLVED INVALID

#21 Compare UXN games between XWayland and X11 to check if there's a penalty 2 months ago

Ticket created by ~whereswaldon on ~whereswaldon/watt-wise