Repository navigation
v0.99.0
Added
-
A container can follow another container's sideways scroll (#1293).
ContainerCfg.ScrollLinkXnames aScrollablecontainer by its effective ID.
The children of the linking container move sideways with that container's
content, while the linking container itself does not scroll. A frozen header
above the rows of a grid uses it, so each header stays above its column. The
offset is read after it was clamped for the frame, so the header never lags
the rows, not even for one frame during a window resize, which reading
Window.ScrollXwhile building the view could not avoid. A wheel or trackpad
scroll over the linking container scrolls the linked one.Tableand
datagriduse it for their frozen headers. -
Transparent frameless windows on the CPU renderer on Windows (#1310). With
GOGUI_RENDERER=soft, or after the automatic fall back to the CPU renderer, a
window withWindowCfg.TransparentandDecorations: gui.DecorationNoneis
see-through: it is a layered window updated withUpdateLayeredWindow, so the
desktop shows through wherever the frame's alpha is below 255, as it does on
GL. A fully transparent pixel is drawn with alpha 1, so the window still takes
mouse input everywhere, as on GL; what is behind it is darkened by 1/255. A
transparent window with a system frame stays opaque on the CPU renderer, and
gui.Debugnow says that a frameless one would be transparent.
SetWindowOpacitystays refused on a transparent window, as on GL. -
Text hinting is a per-window choice, off by default (#1334).
WindowCfg.EnableTextHintingandWindow.SetTextHinting(on)control the stem
snapping that go-glyph v1.28.0 turned on. go-gui now turns it off unless the
app asks for it. With hinting off (the default), glyphs keep their exact
outlines: the text is softer, but stems and curves have the same weight and
the ink stays where the advances put it. With hinting on, vertical stems move
to whole pixels and show as solid columns, but only the stem moves and not the
advance, so straight and curved letters in one word can look out of step
(go-gui-org/go-glyph#198). Apps on go-gui v0.98.0 get unhinted text again
after the upgrade. SetEnableTextHinting: trueto hint at fractional display
scales (125%, 150%); at a whole scale (100%, 200%) text keeps its exact
outline, so the v0.98 stem snapping does not come back there. An app can offer
the choice to its users, because the setter works at runtime and the setting
stays in effect when the backend replaces its text measurer, for example on a
fall back to the CPU renderer. All native backends obey it; the web backend
ignores it. The multisample antialiasing (MSAA) sample count stays fixed at
4x, because it smooths only SVG paths and other triangle meshes, and does not
change text or rectangle borders. -
Shader inputs from GPU buffers, without a copy (#1326).
PixelSurface.UpdateDMABufpublishes a frame that lives in Linux DMA-BUFs,
one per plane, as a hardware video decoder exports it. The OpenGL backend on
Linux imports the buffers through EGL, and the shader samples them directly.
Until now a decoded picture went from the GPU to main memory and back, which
cost go-video about two thirds of its playback CPU time. The frame's
GPUFrame.Releaseruns once no window draws it and the GPU has finished
reading it, so a decoder can reuse the buffer safely. Compressed layouts, such
as Intel's media compression, pass their metadata planes in
DMABufPlane.Metadata.Window.ImportsDMABuftells the producer whether a
window imports. Where it does not (other backends, the software renderer, a
display without the EGL extensions, or once the driver refused a frame's
buffers), the surface draws transparent and the producer callsUpdatePlanes
instead.examples/dmabuf_surfaceshows a producer with a pool of GBM
buffers. -
A Windows app whose OpenGL cannot run it falls back to the CPU renderer
(#1310). WithGOGUI_RENDERERunset, the first window tries GL. If its WGL
context is refused, or the GL functions cannot be bound, as on Microsoft's
generic OpenGL 1.1 in a VM or an RDP session without a GPU driver, the window
opens on go-gui's CPU renderer instead of failing withErrNoGPUContext, and
every later window of the process opens there too. One log line names the step
that failed, its cause and, where a context was made,GL_VERSIONand
GL_RENDERER; it says that custom shaders are not drawn and that
GOGUI_RENDERER=glreports the error instead. A machine whose GL comes up,
Mesa'sopengl32.dllbeside the exe included, stays on GL and makes the same
calls as before, except that the swap interval is now set after the GL
functions are bound. A GL that comes up but cannot build the built-in shaders
still fails withErrNoGPUContext, and so does a later window whose GL fails
in a process whose first window is on GL. Across a fallback, a window the app
hid before the start stays hidden, placement requests made before the backend
started reach the window that opens,OnInitruns once, andgui.Debug
reports only what holds for that window. A window the app opens while the
first one starts, from anOnSystemAppearancehook, opens on the renderer the
first window chose. One opened before that choice, from the app's log writer
on a startup warning or from another thread at the same moment, does not wait
for it: it tries GL with the same fallback on its own. -
GOGUI_RENDERER=softruns a Windows app without OpenGL (#1310). The
Windows backend draws with go-gui's own CPU renderer, the one Linux uses, and
copies each frame to the window through GDI. The process loads no
opengl32.dll, not even a Mesa DLL beside the exe, so an app starts on a
machine whose OpenGL cannot run it: a VM or RDP session without a GPU driver,
where Windows has only its generic OpenGL 1.1. Events, IME, UI Automation, DPI
handling and window state are the GL path's own code; a live resize repaints
each size, and whole-window opacity works. Frames are paced to the monitor's
refresh rate unlessWindowCfg.VSyncOffis set. AWindowCfg.Transparent
window with a system frame is opaque on this path and reports it through
gui.Debug. Custom shaders draw their children but not their shader fill. The
"no GPU context" message on Windows now namesGOGUI_RENDERER=soft. With the
variable unset orgl, a machine whose GL comes up makes the same calls as
before.
Changed
-
Text hinting runs only at fractional scales (go-gui-org/go-glyph#198).
go-glyph is now v1.29.1. WithEnableTextHintingon, stems snap only when the
display scale is fractional, such as 125% or 150%. At a whole scale (100%,
200%) text keeps its exact outline, which looked better there. Hinted bowls
such as "o" no longer lean: both edges of a stem now snap. Hinted letter
spacing stays uneven by up to about 1 px, a documented limit. -
A table with a frozen header scrolls sideways on its own (#1293). A
TablewithFreezeHeaderused to grow as wide as its columns, so in a
narrower parent the last columns and the vertical scrollbar were out of reach.
It now fits the width itsSizinggives it. When the columns are wider, the
rows show a horizontal scrollbar, the header moves sideways together with the
rows while it stays frozen at the top, and the vertical scrollbar stays at the
visible right edge. A wheel or trackpad scroll over the header scrolls the
rows. A table withoutFreezeHeaderalready fitted its parent and scrolled
sideways, but its horizontal scrollbar was hidden; it now shows.Scrollbar
applies to both scrollbars of every table. Like the strip on the right for the
vertical scrollbar, every table now keeps a strip at the bottom for the
horizontal one, so the last row is never covered; a table that sizes to its
rows is that much taller. The frozen header keeps the same side gutter as the
rows, so the columns stay in line. Wrapping the table in a sideways-scrolling
Columnis no longer needed: the table now fits inside such a wrapper, which
then has nothing to scroll. -
Docs describe the desktop as cgo-free. README,
llms.txt, the Makefile,
CONTRIBUTING, the backend debugging notes, and the affected specs now say
macOS, Linux and Windows build withCGO_ENABLED=0and no C toolchain.
iOS/Android and the opt-in-tags hunspell/-tags otoaudiostill need cgo.
The API does not change. -
BREAKING: macOS needs no cgo, and Intel Macs are not supported (#1323).
The Metal renderer (metal_darwin.m) is now Go and calls Metal through
purego. This is the last step of the port that #1304 decided, so the macOS
backend has no Objective-C and no cgo. A macOS app builds withCGO_ENABLED=0
and with no C toolchain, and it cross-compiles from Linux or Windows. The cost
is darwin/amd64: an app built for an Intel Mac now stops at link with
macOS_requires_arm64__Intel_Macs_are_not_supported. Migration: build for
GOARCH=arm64. The release.dmgis arm64 only, not universal. The renderer
now batches quads: a run of rects or glyphs that use the same state is one
draw call, not one call per quad. Encoding a frame of 20,000 quads takes about
0.4 ms on the CPU, with no heap allocation.buildapp -build-pkgbuilds macOS
with cgo off. The API does not change. -
macOS locale, keychain, sounds, keep awake and appearance no longer use cgo
(#1307). These five services now call the system frameworks through purego.
This is step 1 of the port that #1304 decided. The rest of the macOS backend
still needs cgo, so a macOS app still builds with cgo on. One change shows
now: withCGO_ENABLED=0on macOS,LocaleAutoDetectreads the system
locale. Before, it read only theLC_ALL,LC_MESSAGESandLANGvariables.
iOS keeps its cgo code. The API does not change. -
macOS file dialogs, alerts, print and spell check no longer use cgo
(#1312). These services now call AppKit and PDFKit through purego. This is
step 2 of the port that #1304 decided. The rest of the macOS backend still
needs cgo. The API does not change. -
The macOS menubar and tray no longer use cgo (#1314). They now call AppKit
through purego. This is step 3 of the port that #1304 decided. The rest of the
macOS backend still needs cgo. The API does not change. -
The macOS accessibility tree no longer uses cgo (#1317). VoiceOver now
reads the tree through purego. This is step 4 of the port that #1304 decided.
The rest of the macOS backend still needs cgo. The API does not change. -
The macOS window, events, IME and app delegate no longer use cgo (#1321).
metal_window_darwin.mis gone: the window, its content view, the event poll,
the input method client, the frame pump and the clipboard call AppKit through
purego. This is step 5 of the port that #1304 decided. Only the Metal renderer
still needs cgo. The event poll and the wake that the animation loop posts
each frame make no heap allocation, as before. One change shows: a window
title or clipboard text with bytes that are not valid UTF-8 now has each bad
byte replaced by U+FFFD. Before, the title stayed as it was and the clipboard
text was dropped. The API does not change. -
The CPU renderer clears a frame with a block copy (#1327).
soft.Renderer
painted the background four bytes at a time, which was the largest single cost
of a simple frame: 36 % of the draw at 1920×1080. It now stores one pixel and
doubles it withcopy. The clear itself takes 0.28 ms instead of 1.70 ms at
1920×1080 and 1.25 ms instead of 6.75 ms at 3840×2160; a frame of 100 buttons
takes 3.5 ms instead of 5.2 ms at 1920×1080. Every pixel is the same as
before. X11, Wayland andsoft.RenderToImageshare the gain. The API does not
change. -
The CPU renderer fills solid shapes through a coverage mask (#1327).
soft.Rendererletx/image/vectorblend a solid rect, border, circle or
line itself, which works out every pixel of the shape's bounding box, even
where the shape does not reach it or covers it with an opaque color. On a view
of rounded fills and borders that was 65 to 81 % of the draw. The coverage now
goes into a reused 8-bit mask, as it already did for gradients and images, and
a loop of Go-Gui's own blends it: it skips uncovered pixels, stores an opaque
color where coverage is full, and blends the rest with the same 16-bit
arithmetic. A frame of 100 buttons takes 1.75 ms instead of 3.39 ms at
1920×1080, and a dense page 10.69 ms instead of 37.25 ms; text-heavy frames
are unchanged. The mask keeps 8 bits of coverage where the rasterizer read 16,
so an antialiased edge pixel of a solid fill can differ from before: by one
level per channel under one edge, and by up to two levels in the tested views
where edges overlap. Uncovered and fully covered pixels are the same as
before. X11, Wayland, Windows andsoft.RenderToImageshare the gain. The API
does not change. -
The CPU renderer draws text faster (#1327).
soft.Rendererblended a
glyph one pixel at a time through two calls, each of which worked out the
atlas and frame offsets again; that was 54 to 66 % of the draw on a text-heavy
view. It now takes the atlas row and the frame row once per row. A glyph quad
of 16×32 px takes 3.9 µs instead of 5.0 µs, and a frame of 1,000 text widgets
takes 8.6 ms instead of 11.1 ms at 1920×1080. Every pixel is the same as
before, and a test compares the two paths. X11, Wayland and
soft.RenderToImageshare the gain. The API does not change. -
The CPU renderer converts a frame to the window's byte order faster
(#1327). Each frame the CPU renderer shows is converted from R, G, B, A to
the B, G, R, A order that X11, Wayland and a Windows bitmap take. The
conversion moved one pixel a step; it now moves two pixels as one 64-bit word.
A 1920×1080 frame takes 1.6 ms instead of 2.0 ms, and a 3840×2160 frame 6.6 ms
instead of 8.1 ms. Every byte is the same as before, and a test compares the
two forms. The API does not change.
Fixed
-
The first window gets the machine's OpenGL on Windows (#1348). The system
opengl32.dllwas loaded by the firstwglCreateContextcall, after the
pixel format was set, and on some machines anopengl32.dllloaded that late
gives no context. There the first WGL context of every process was refused
with "The pixel format is invalid.", and since the automatic fall back to the
CPU renderer (#1310) every window of the app drew on the CPU, even where
OpenGL works: a VirtualBox guest with Guest Additions and 3D acceleration has
OpenGL 4.1. WithGOGUI_RENDERER=glthe first window failed with
ErrNoGPUContextthere. The backend now loads the DLL before the first
pixel-format call, as it already did for a Mesa beside the exe; with
GOGUI_RENDERER=softit still loads none. On a VM with only Microsoft's
generic OpenGL 1.1 the window still falls back, and the log line now names the
binding step (bind GL functions failed, withGL_VERSIONandGL_RENDERER)
instead ofcreate WGL context failed. Anopengl32.dllthat cannot be
loaded at all now falls back too, or isErrNoGPUContextwith
GOGUI_RENDERER=gl, where it was a panic at the first WGL call. -
End and the arrow keys show the whole last row of a table (#1293). A
focusableTablescrolled the active row into a view as tall as the table's
Height. WithFreezeHeaderthe rows have less room than that, because the
header sits above them, so End left the last row partly hidden under the
bottom edge. Keys now scroll by the height the rows are really shown in, which
also leaves out the new strip for the horizontal scrollbar. -
A data grid's frozen header stays in line with its columns (#1293). With
FreezeHeader, the header, the quick filter and the frozen top rows took the
rows' sideways scroll offset while the view was built, before the offset was
clamped for the frame. When the grid got wider while scrolled to the end, as
in a window resize, the header sat out of line with the columns for one frame,
by as much as the grid grew. They now follow the rows through
ContainerCfg.ScrollLinkX. Under a right-to-left locale the header showed
other columns than the rows below it; it now lines up there too. A wheel or
trackpad scroll over the header scrolls the rows. -
A window resized before its event loop starts draws at its real size on
Windows (#1310). A resize that reached the window betweenNewandRun
was lost: the backend kept the size the window was created with, and the first
frames were drawn at that size until the next resize, on OpenGL and on the CPU
renderer.RunandRunAppnow check the window's size and scale when they
take the window, and adopt them before the first frame; the application gets
theEventResizedafterOnInit, and inRunAppwith the window registered,
as for any other resize. On the CPU renderer this also matters for a
transparent frameless window, which shows nothing until it gets a frame of its
own size. -
Size limits of a frameless window mean its client area on Windows (#1310).
MinWidth,MinHeight,MaxWidthandMaxHeighton a resizable
DecorationNonewindow were applied with the resize border added, although
such a window has no frame: at 100 % aMinWidthof 200 stopped the window at
214 px and aMaxWidthof 400 let it grow to 414 px, on OpenGL and on the CPU
renderer. The limits are now the client sizes asked for, as on a window with a
system frame. -
Borders and fills land on whole device pixels (#1334). A rect or a 1px
border placed at a fractional position — a button centred in a row whose
leftover height is odd sits at y = n+0.5 — drew its top and bottom edges as
two faint rows that never reached the border color, while its sides stayed
crisp. At 125% or 150% scale every edge was fractional. Every backend now
rounds the device edges of a rect, a gradient fill and a gradient border to
whole pixels, and a stroke's device thickness to whole pixels (at least one),
so a 1px border is one full-strength row on every side at any position and
scale. A gradient border's four sides share one rounded thickness. The iOS and
Android clip now rounds outward like the desktop one, so a snapped edge is not
cut off. Edges round, not sizes, so boxes that share an edge still meet.
Layout geometry, hit testing and the render commands do not change. Two
visible effects: a progress bar's fill grows in whole-pixel steps, and on the
web backend a stroke now lies inside its box, as it already did on the GPU and
soft backends, instead of straddling its edge. -
Closing one window on X11 no longer freezes the others (#1284). EGL gives
every window of a multi-window app the same display, and closing a window
terminated it. Each surviving window then failed every swap with
EGL_NOT_INITIALIZEDand stayed on its last frame. It still took input but
never redrew, so it looked covered by an invisible overlay. The X11 backend
now counts the windows on the display and terminates it only when the last one
closes, as the Wayland backend already did. Windows and macOS were not
affected. -
A GL window whose
OnSystemAppearancehook opens another window keeps a
valid blank texture (#1310). The hook runs while the first window starts,
and the window it opens leaves its own OpenGL context current. The first
window then created the 1×1 transparent texture that stands in for an unused
shader channel in that other context, so its custom shaders sampled a texture
name that did not exist in their own. The texture is now created before the
hook can run. Windows, X11 and Wayland share this step. -
A Windows app on Microsoft's generic OpenGL exits with advice instead of a
panic (#1310). Without a vendor GPU driver, for example in a VM or an RDP
session, Windows has only Microsoft's generic OpenGL 1.1 ("GDI Generic"). When
the backend got a context from it, binding the OpenGL 3.3 functions failed and
Runpanicked with a stack trace. That failure, and a failure to build the
built-in shader pipelines, now returnErrNoGPUContext, so the app prints the
cause and the "no GPU context" advice and exits non-zero, with no stack trace.
The message names theGL_VERSIONandGL_RENDERERthe context reported. A
machine whose OpenGL works makes the same calls as before. -
A macOS VoiceOver announcement with text that is not valid UTF-8 no longer
stops the app (#1317). NSString gives nil for such bytes, and the dictionary
that held the text raised an exception, soA11yAnnouncestopped the app. A
node label, value or description with such bytes was lost. The bad bytes now
show as U+FFFD in both. -
The macOS accessibility root no longer acts as the first node (#1317). The
root element had node index 0. It reported focus when node 0 had focus, and a
VoiceOver press on the root pressed node 0. The root now has no focus and no
action. -
macOS VoiceOver hears focus that comes back to the same widget (#1317).
When focus left the tree (for example, a click on empty space) and came back
to the widget that had it last, no focus change was posted. VoiceOver then did
not move to that widget. Each return of focus is now posted. -
A bad parent index no longer makes a cycle in the macOS accessibility tree
(#1317). A node that named itself, or a later node, as its parent was cut
off from the root, and VoiceOver walked the loop for ever. Only an earlier
node is now a valid parent. Any other index attaches the node to the root. -
macOS spell check marks the right word after a byte order mark (#1312).
NSString drops leading byte order marks (U+FEFF), andspellcheck.Check
counted its ranges from the shortened string. Every misspelled range after the
marks started 3 bytes early per mark, so the underline sat to the left of the
word.CheckandSuggestnow measure how many marks were dropped and count
from the original text. -
The macOS print dialog prints the requested number of copies (#1312).
NativePrintParams.Copieswas set after the print operation was built, and
the operation keeps its own copy of the print settings, so every print came
out as one copy. The copy count is now set first. -
A macOS menu title that is not valid UTF-8 no longer stops the app
(#1314). NSString gives nil for such bytes, and NSMenuItem raises an
exception on a nil title, soSetNativeMenubarstopped the app. This applied
to item text, menu titles, the app name and the tray tooltip. The bad bytes
now show as U+FFFD. An item ID that is not valid UTF-8 still fires no
callback. -
Custom shaders draw on iOS (#1299). The Metal pipelines built for
Shader
declared no stencil format, while the main pass they draw in has a Stencil8
attachment. On iOS, Metal's validation stopped the app at the first custom
shader draw, and without validation (an app started from the home screen) the
screen stayed blank; go-video's player showed no picture. The custom pipelines
now declare the pass's stencil format on iOS and macOS, as go-gui's own
pipelines do. macOS drew without validation, but by chance. -
The iOS backend links CoreGraphics (#1300). It calls CoreGraphics
(CGRectGetMaxY,CGRectZeroand others) but linked only Metal, QuartzCore,
Foundation and UIKit. An app built in Xcode linked anyway, because its project
links CoreGraphics; a plain Go executable that imports the backend, such as a
test binary built withGOOS=ios, failed with undefined_CG…symbols unless
CGO_LDFLAGSnamed the framework. -
Markdown paragraph text uses full body contrast (#1297). Paragraphs, table
cells and list markers took the secondary role, so ThemeLight prose read as
mid gray next to near-black headings. They now take the body color at full
contrast in ThemeLight and at about 80% in ThemeDark, where full contrast
reads too bright for long text. Code comments and blocked-image placeholders
stay secondary. -
Windows tray icons come back after Explorer restarts (#1308). When the
shell restarts, after a crash or a manual restart, it drops every
notification-area icon and broadcastsTaskbarCreatedso that applications
add theirs again. The tray window was message-only, and a message-only window
gets no broadcasts, so the icon stayed gone and an app hidden to the tray
could not be reached. The tray window is now a hidden top-level window that
hears the message and adds every live tray entry again, with its current icon,
tooltip, click action and menu. When the icon still exists, as after a DPI
change, it is updated in place instead of added twice. The window stays out of
the taskbar and Alt+Tab, and ignores aWM_CLOSEsent from outside, as
taskkillwithout/Fsends one.
What's Changed
Features
Bug fixes
- fix(ios): link CoreGraphics by @ollex in #1302
- fix(metal): custom shader pipelines declare the stencil format by @ollex in #1301
Other changes
- fix(gui): markdown paragraphs take a per-theme prose role (#1297) by @mike-ward in #1305
- docs(specs): #1304 purego macOS investigation and port decision by @mike-ward in #1306
- refactor(darwin): port locale, keyring, sounds, keep awake, appearance to purego (#1307) by @mike-ward in #1311
- refactor(darwin): port file dialogs, print, spell check to purego (#1312) by @mike-ward in #1313
- fix(gui/backend/sni): Windows tray icons come back after Explorer restarts (#1308) by @PLN in #1309
- refactor(darwin): port menus and tray to purego (#1314) by @mike-ward in #1315
- refactor(darwin): port accessibility to purego (#1317) by @mike-ward in #1318
- refactor(darwin): port window, events and IME to purego (#1321) by @mike-ward in #1322
- refactor(darwin): port renderer to purego (#1323) by @mike-ward in #1324
- docs: desktop is cgo-free since macOS purego port (#1323) by @mike-ward in #1325
- docs(specs): #1310 Windows software renderer plan by @PLN in #1320
- test(spellcheck): compare Suggest guesses as sets by @mike-ward in #1330
- fix(gl): a Windows GL bring-up failure is a GPU-context failure (#1310) by @PLN in #1319
- test(gui): pulse test no longer depends on runner speed (#1331) by @mike-ward in #1332
- perf(gui/backend/soft): clear the frame with a block copy (#1327) by @PLN in #1328
- perf(gui/backend/soft): blend a glyph quad by row (#1327) by @PLN in #1329
- feat(gl): GOGUI_RENDERER=soft on Windows (#1310, phase 2) by @PLN in #1333
- fix(gl): closing one X11 window no longer freezes the others (#1284) by @mike-ward in #1336
- perf(gui/backend/gl): swizzle two pixels as one word (#1327) by @PLN in #1335
- perf(gui/backend/soft): composite solid fills through the coverage mask (#1327) by @PLN in #1337
- feat(gl): import GPU frames from DMA-BUFs without a copy (#1326) by @ollex in #1339
- fix(gui/backend): snap rect, stroke and gradient edges to device pixels (#1334) by @mike-ward in #1340
- feat(gl): automatic CPU fallback on Windows (#1310, phase 3) by @PLN in #1338
- feat(gui): turn text hinting off per window (#1334) by @mike-ward in #1341
- feat(gui): text hinting off by default, EnableTextHinting (#1334) by @mike-ward in #1343
- feat(gl): transparent frameless windows on the CPU renderer on Windows (#1310, phase 4) by @PLN in #1344
- deps: bump go-glyph to v1.29.1 (hinting at fractional scales only) by @mike-ward in #1347
- fix(gl): load the system opengl32.dll before the first pixel format on Windows (#1348) by @PLN in #1349
- deps: bump indirect dependencies by @mike-ward in #1350
- changelog: add v0.99.0 by @mike-ward in #1351
Full Changelog: v0.98.0...v0.99.0