Added
-
RenderCmd.VertexColorsFlatmarks vertex colors that are not a gradient
(#945) — aRenderSvgcommand can now carry triangles of different flat
colors that must blend over each other in order, as separate commands would. A
backend that blends every triangle in submit order (Metal, GL, web, iOS,
Android) needs no change. A backend that draws vertex colors as one seamless
mesh must draw a flagged command as ordered same-color runs instead; the soft
backend now does, so its screenshots of aThinkingOrbare unchanged. -
DrawCanvasCfg.VersionFnreads a canvas version at render time (#939) — a
canvas whose content changes between frames could not repaint under a
render-only refresh (InvalidateRender,AnimationRefreshRenderOnly):
Versionis read only while the view is built, which such a frame skips. The
choices were a full frame (InvalidateLayout) orAlwaysRedraw, which runs
OnDrawon every pass.VersionFnis called when the canvas is drawn, and
OnDrawruns again only when its value changes.OnDrawmust read the same
live state, andVersionFnruns under the window lock, so it must be cheap
and must not call window APIs; an atomic load is the intended use. A panic in
it falls back toVersion. -
InWindowOpenDialog,InWindowSaveDialogandInWindowFolderDialog
(#831) — open the in-window file browser on purpose, on any OS, without
trying the native picker first. They take the sameNative*DialogCfgtypes
and report through the sameOnDone, so moving a call between the two is a
rename. Use them when an app wants one look on every OS, or to show the
browser in a demo. Paths have a zeroGrant: on macOS a sandboxed app gets no
security-scoped access this way and should keepNative*Dialog. The showcase
shows all three under Overlays → Dialog → In-Window File Browser. -
Showcase has a DX Cheat Sheet page — the cheat sheet in
docs/dx-cheat-sheet.mdlists the places where the obvious reading of the API
is wrong, but people who use the showcase did not see it. It is now under
Welcome → DX Cheat Sheet. The showcase embeds a copy, becausego:embed
cannot read outside its package.TestDocMirrorsfails when the copy and
docs/differ; to update the copy, run
go test ./examples/showcase/ -run TestDocMirrors -update. -
LoadSecret/SaveSecret/DeleteSecretkeep secrets in the OS
credential store (#920) —SaveSettingswrites plain JSON, so an app that
kept an access token had to write its own store. The new functions use the
Keychain on macOS and iOS, Credential Manager on Windows, and the Secret
Service (GNOME Keyring, KWallet) on Linux, with the app ID as the service
name. A value is 1 to 2560 bytes on every platform. Where no store exists
(web, Android, a Linux session with no Secret Service daemon) they return
ErrSecretsUnsupportedand never fall back to a plain file. A missing key
returnsErrSecretNotFound.NewTestWindowuses a memory store. See
docs/specs/secure-storage.md. -
Experimental native Wayland backend behind
GOGUI_WAYLAND=1(#919) — on a
Wayland desktop go-gui ran only through XWayland, which blurs at fractional
scales and is unavailable on devices with no X11 EGL platform (#916). With
GOGUI_WAYLAND=1a Linux app (amd64 or arm64) opens native Wayland windows.
They render with the same GL renderer at fractional and integer scales, take
pointer, keyboard, scroll, touch and input method (text-input-v3) input, share
the clipboard and primary selection, set cursors, and move and resize. The
frame comes from the compositor (KDE, wlroots) or from libdecor (GNOME,
Cinnamon, weston), and a warning names the missing package when neither can
draw one. Without the variable nothing changes. If Wayland setup fails (no
compositor, or no libwayland-client, libwayland-egl or libxkbcommon), go-gui
prints a warning and uses X11. The build stays cgo-free: the libraries are
opened at run time. Tested under sway, weston, KWin and Cinnamon 6.6; reports
from other desktops and GPUs are wanted on #919. See
docs/specs/wayland-backend.md. -
DialogCfg.EscapeDisabledstops Escape from closing a dialog (#909) — a
progress dialog had no way to block the Escape path, so the user could close
it before the work finished. SetEscapeDisabledto keep the dialog open. A
blocked Escape stays unhandled, so content in the dialog can still use the
key.DialogDismiss()still closes the dialog, andOnCancelNodoes not fire
for a blocked Escape. -
DrawContext.Rotateturns canvas drawing by an angle (#904) — the canvas
transform stack (Translate/ScaleBy/Save/Restore) was scale and
translate only, so a rotated shape, text or image could not be drawn; the
qcpainterbench Flower port now draws its cached outline under a
rotate-about-center instead of rotating 193 points on the CPU every frame. The
transform is now the full 2×3 affine, composed in call order (positive angles
turn clockwise, as inTextStyle.RotationRadians), and geometry still rides
unbaked: batches andRenderCmdcarry all six floats (XformXY/XformYX
join the existing fields) for every backend to apply per vertex. Text maps its
anchor through the matrix and gains the angle onRotationRadians(or a
composedAffineTransform, which keeps precedence); images record their
rotated frame for a backend rotation bracket; the lowered radial-quad path
survives rotation (a circle stays a circle) and still falls back to the ring
mesh under a non-uniform scale.DrawRecorderexporters see baked coordinates
with no interface change: rotated rects arrive as outline polygons, rotated
ellipses flatten at the arc tolerance.DrawCanvasTriBatch.Transformkeeps
its shape but returnsok=falsefor a rotated batch, whose vertices are still
in local space; a caller that readsok=falseas "already in canvas space"
misplaces rotated geometry. MoveTransformcallers to the new
TransformAffine, whoseok=falsemeans untransformed only. -
WindowCfg.VSyncOffpresents without waiting for vsync (#907) — a
renderer benchmark that redraws every frame read the display refresh rate
until a frame took longer than one refresh, so it could not report raw
throughput. The flag is opt-in and fixed when the window is made; the default
keeps vsync on. X11 sets EGL swap interval 0 and Windows sets WGL swap
interval 0. macOS, iOS, Android and web ignore the flag: on macOS the window
compositor hands back a Metal drawable once per refresh even with the layer's
display sync off, in a window and in full screen. An idle window still sleeps,
and animations still tick every 16 ms: frames run past the refresh rate only
when the app invalidates every frame.gui.Debugreports a refused or ignored
flag underDebugWindowDegraded, through the newWindow.DebugWindowVSync.
examples/qcpainterbenchtakes-novsync. -
examples/qcpainterbench, a canvas benchmark ported from Qt (#723) — it
draws the six workloads of Qt's qcpainterbench (ruler, circles, bezier lines,
bars, icons and text, flower) throughDrawCanvas, N times per frame. It
shows FPS and go-gui's CPU time per frame.-sweep 1,2,4,…,512prints one CSV
row per render count. No Qt code is copied: the workloads follow the behavior
written indocs/specs/qcpainterbench.md. Vsync stays on, so FPS stops at the
display refresh rate; round caps rideStrokeStylesince #905, and concave
path fill is emulated in the example and tracked in #906 (rotation since #904
ridesDrawContext.Rotate). -
Canvas strokes take caps and joins through
StrokeStyle(#905) —Line,
Polyline,PolylineJoined,Arcand the beziers (plusCircleand
RoundedRect) each gain a*Styledtwin that draws round and square caps and
round joins on top of the one strokergui/svgshares. The zero style draws
exactly what the unstyled call draws, so existing code sees no change in
pixels, triangle counts or recorder output. A recorder that wants the style
implements the optionalDrawStrokeRecorderextension; all others still get
the stroke as the equivalent unstyled primitive. The qcpainterbench Circles
port drops its 34 half-disc fills per pass, and the curves draw with round
joins like Qt. -
Canvas paths fill concave shapes through
CanvasPath(#906) — a reusable
path value built withMoveTo/LineTo/QuadTo/CubicTo/ArcTo/
Close, drawn withFillPath(solid color),FillPathGradient(gradient)
andStrokePath(color, width,StrokeStyle). Fills honorFillNonzero(the
zero value, as in SVG) andFillEvenOdd, so holes carve and overlaps follow
the rule instead of fanning from the first point the wayFilledPolygondoes.
The tessellator is the onegui/svgshares, moved togui/internal/pathfill;
SVG output is unchanged.Resetrebuilds a path without allocating, and a
redrawn canvas fills its paths with zero allocations. A recorder that wants
the path implements the optionalDrawPathRecorderextension; all others
still get the fill as one flat polygon per triangle and the stroke as one
joined polyline per contour. The qcpainterbench Lines port fills path cubics
closed to the baseline and the Flower port fills its cached outline as one
closed contour, dropping both hand-built triangulations.
Changed
-
A
ThinkingOrbframe is one draw command, not hundreds (#945) — each line
and dot of the orb has its own color, and a canvas batch held only one color,
so a frame sent between 1 and 534 triangle batches to the backend for one
small widget. The orb now draws every mark into one batch with a color per
vertex, in the same order, so the pixels do not change. Other canvases keep
one color per batch: a reader ofDrawContext.Batches()that looks only at
Color, such as go-charts' PNG export, stays correct. -
Looping loading widgets repaint without a layout (#939) — an indefinite
ProgressBar, aSkeleton, aMathSpinnerand aThinkingOrbused to run
the view function and layout for the whole window on every animation tick, 60
times a second. Their ticks now ask for a render-only frame, which redraws
from the layout already built. On a 200-button window a ProgressBar tick drops
from about 142 µs and 1600 allocations to about 7 µs and none. What they draw
is unchanged: a test checks that a render-only frame emits the same commands
as a full frame.Pulsarand animated text still use full frames. -
Widget factories no longer copy their Cfg to the heap on every call (#937)
— a factory with an auto-ID branch built aViewFuncclosure that captured
thecfgparameter. A Cfg is larger than the 128 bytes Go copies into a
closure, so Go moved the whole Cfg to the heap at the start of each call, also
whenIDwas set and the closure was never built. The branch now captures a
copy of its own, and handlers that read a few Cfg fields capture those fields.
A frame of 50 rows (BenchmarkViewFrame/rows_50) drops from 353 to 202
allocations, from 158 KiB to 87 KiB, and builds 30% faster. A frame of 50
buttons drops from 453 to 352 allocations.Column,Row,Buttonand most
input factories now allocate once per call, the view itself.
TestFactoryCfgDoesNotEscapeholds each factory to its count. No API changes. -
File dialogs fall back to an in-window file browser (#831) — when there is
no native file picker,NativeOpenDialog,NativeSaveDialogand
NativeFolderDialogused to callOnDoneat once with aDialogError
("unsupported", or"no_dialog_tool"on Linux without zenity or kdialog).
The user saw nothing. They now open a file browser inside the window: a path
bar, a folder list, a filter select when there is more than one filter, and a
name field for save. Enter accepts, Escape cancels, and focus stays in the
dialog.OnDonegetsDialogOKwith the chosen paths, orDialogCancel.
This also applies to a nil native platform, soNewTestWindowtests now see
the browser, and can drive it withTestKeyandTestClick. A test that
expected the"unsupported"error must change. A badCfgand a real
platform error still reportDialogError. Paths from the browser have no
macOS security-scoped grant. Seedocs/specs/in-window-file-browser.md. -
guino longer carries a MinGW__ms_vsscanfshim on Windows (#886) —
gui/compat_mingw.godefined a weak__ms_vsscanffor the SDL2 static
libraries, which were removed in #60. It was the only cgo file inguion
Windows, so a cgo-enabled Windows build ofguinow compiles no C. An app
that links its own MinGW static library that needs__ms_vsscanfmust now
supply the symbol.
Fixed
-
Shift+Arrow and Shift+Home/End select text on X11 again (#948) — X servers
list arrows, Home and End with an empty shifted keysym column, and the X11
backend handed that emptyNoSymbol(0) to the input method as the key. IBus,
the default on GNOME and Fedora, swallowed it, so a Shift+motion key never
reachedInputand no selection grew. The lookup now falls back to the
unshifted keysym, as the core protocol specifies, and the key arrives with
ModShiftintact. -
Two
MathSpinners no longer share one animation (#941) — a spinner keyed
its tick and progress by the bareID, so two spinners with the sameID
under different ID-bearing parents, or two with noID, drew the same frame.
It now keys them by its effective ID, likeThinkingOrb, andIDmay be
empty: the spinner takes a generated leaf. The*Windowargument is now
unused and kept so callers still compile. -
A canvas whose batch count changes per redraw no longer allocates (#940) —
a redraw that emitted fewer triangle batches or lowered gradients than the one
before dropped the spare pooled buffers, so the next larger redraw allocated
them again. AThinkingOrbtick, whose batch count moves every frame,
allocated about 7 times; it now allocates nothing once the animation has run a
full cycle. A canvas now keeps the buffers of its largest redraw for as long
as its cache entry lives. -
An idle window with a focused input stops rendering after 10 s (#929) —
the caret blinked for as long as an input held focus, and each blink presents
a full frame. With software GL on a slow device, such as a phone running
Phosh, that cost 30–80% of a core while the app sat untouched. The caret now
stops blinking after 10 s with no caret activity, the same default as GTK's
gtk-cursor-blink-timeout. It stays solid, the blink animation retires, and
the window renders nothing until something happens. Typing, clicking or
dragging in the field, moving focus, or refocusing the window starts the blink
again. APulsarkeeps blinking. -
Linux: no double scale under XWayland when
Xft.dpiis unset (#918) — on
a Wayland desktop that does not publishXft.dpi(Phosh), the X11 path took
its scale from the monitor's physical DPI. The compositor also scales XWayland
windows by the output scale, so the scale was applied twice: on a FuriLabs
FLX1s at 174%, go-gui drew at 1.81 and the compositor enlarged that by 1.74,
and at 100% go-gui was still about twice the size of other apps. Under
XWayland with noXft.dpi, the scale is now 1.0, the same as GTK and Qt, and
the compositor applies the desktop scale.Xft.dpi, when set, still wins.
Bare X11 sessions keep the per-monitor RandR scale. -
Closing one window no longer blanks the others' GL resources (#921) — each
window owns an unshared GL context, and object names repeat across them, so
destroying a window freed the surviving windows' same-numbered textures,
buffers, VAOs and shader programs instead of its own. The window now makes its
own context current before deleting its objects. Single-window apps were never
affected. -
Linux: GL starts when the default EGL driver has OpenGL ES only (#916) —
on a libhybris phone (FuriLabs, Phosh on Wayland) the default EGL display is
the Android GPU driver, which has no desktop-OpenGL config, so every app
failed witheglChooseConfig: no matching config (egl error 0x3000). When the
default display has no desktop-GL config, the backend now tries the Mesa X11
platform display (eglGetPlatformDisplay). On that phone Mesa renders in
software (llvmpipe), so the app runs but is slow. When no display has desktop
GL, the error now says the driver offers OpenGL ES only, in place of only the
old "update the GPU driver" hint. Desktop systems are not affected: their
default display succeeds and the fallback never runs. -
macOS: event loop no longer leaks one
NSEventper frame — the Metal
backend polled AppKit events with no autorelease pool, and the Go event loop
has no Cocoa run loop to drain one. Every dequeued event and every wake event
stayed in memory, so an app with a repeating animation (thesolar_system
example) grew by about 60 events, ~40 KB, a second for as long as it ran. The
poll now drains its own pool, and memory stays flat. -
SVG round joins and square caps draw on the correct side (#905) — the
round-join fan swept the long way around the vertex, painting the inner disc
the segment quads already cover and leaving the outer corner open, and the
square cap extended sideways along the normal instead of along the path.
Moving the stroker intoguiexposed both, confirmed with coverage probes
before the fix. Round caps, miter joins and bevel joins were already correct
and draw byte-identical output.
What's Changed
Performance
- gui: repaint looping loading widgets without a layout (#939) by @mike-ward in #942
Other changes
- Initialize FUNDING.yml with funding options by @mike-ward in #901
- Update GitHub Sponsors username in FUNDING.yml by @mike-ward in #902
- ci: add asyncpreemptoff Windows test leg (diagnostic for #886) by @mike-ward in #903
- examples: add qcpainterbench, a port of Qt's canvas benchmark by @mike-ward in #908
- gui: add WindowCfg.VSyncOff for renderer benchmarks (#907) by @mike-ward in #910
- gui: add DrawContext.Rotate for canvas rotation (#904) by @mike-ward in #911
- gui: add DialogCfg.EscapeDisabled to block Escape close (#909) by @mike-ward in #912
- gui: add StrokeStyle caps and joins for canvas strokes (#905) by @mike-ward in #913
- gui: add CanvasPath with nonzero/even-odd fill (#906) by @mike-ward in #914
- metal: drain autorelease pool in metalPollEvent by @mike-ward in #915
- gl: fall back to Mesa X11 EGL display when default has no desktop GL (#916) by @mike-ward in #917
- gl: experimental native Wayland backend behind GOGUI_WAYLAND=1 (#919) by @mike-ward in #923
- svg: assert dash cap deterministically in pathological-cycle test by @mike-ward in #925
- gl: make window context current before destroying GL resources (#921) by @mike-ward in #926
- gl: skip RandR DPI scale under XWayland (#918) by @mike-ward in #927
- gui: store secrets in the OS credential store (#920) by @mike-ward in #928
- showcase: add DX Cheat Sheet page under Welcome by @mike-ward in #931
- build: bump pinned golangci-lint to v2.14.0 by @mike-ward in #932
- gui: stop caret blink after 10 s idle (#929) by @mike-ward in #933
- gui: log Windows module bases in tests, drop MinGW shim (#886) by @mike-ward in #934
- gui: log PE symbol-server key per Windows test module (#886) by @mike-ward in #935
- gui: in-window file browser fallback for native file dialogs (#831) by @mike-ward in #936
- gui: keep widget factory Cfg off the heap (#937) by @mike-ward in #938
- gui: carry unclaimed canvas batch buffers across redraws (#940) by @mike-ward in #946
- gui: draw a ThinkingOrb frame as one canvas batch (#945) by @mike-ward in #947
- gui: key MathSpinner animation by effective ID (#941) by @mike-ward in #949
- gl/x11: fall back to the unshifted keysym for an empty shift column (#948) by @mike-ward in #950
- changelog: add v0.85.0 by @mike-ward in #951
Full Changelog: v0.84.0...v0.85.0