Skip to content

v0.3.8

Choose a tag to compare

@dyike dyike released this 21 Oct 00:33
· 7 commits to main since this release

Redraw macOS windows during native resize and present glass frames in the transaction.

  • ui/window sets layerContentsRedrawDuringViewResize and topLeft layer contents placement on the NSView, plus a non-scaling, top-left contentsGravity on its layer (chosen for contentsAreFlipped). AppKit now redraws each step of an animated resize instead of scaling cached contents, so text no longer stretches while an ordinary or frosted-glass window is resized. The configuration is dispatched once per window with retained handles, so neither the window goroutine nor the frame lock waits for AppKit.
  • The glass renderer enables presentsWithTransaction only for a frame whose size changed and presents it inside Window.Run on the main thread, so new bounds and pixels become visible together; GPU scheduling stays off the main thread. Stable-size frames, including recovery from idle drawable trimming and fixed-size scrolling, stay asynchronous.
  • TestRealWindowsResize drives 60 Gio size requests, 60 center-preserving native frame changes and 4 native zoom/restore transitions for both ordinary and frosted-glass windows, then checks the view and layer policies, full-resolution drawables, synchronous presents only while resizing, 60 scroll steps without them, and zero idle frames and CPU after trimming. The fix adds no cgo and no Gio patch.

Validation: gofmt, vet, module tests, the offline component check, CGO_ENABLED=0 GOOS=windows go build ./..., and KEEL_DESKTOP=1 go test -run RealWindows ./ui/window on macOS.

本版修正 macOS 窗口缩放:AppKit 在动画缩放的每一步重绘视图,不再拉伸缓存画面,普通窗口和磨砂玻璃窗口里的文字不再变形;玻璃窗口只在尺寸变化的帧里于主线程事务中提交,尺寸不变的帧保持异步。修复位于 ui/window,没有新增 cgo,也没有修改 Gio。

Compare: v0.3.7...v0.3.8