Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
18b3038
feat(ui): drive buttons from the engine and link declared controls
t8y2 Nov 20, 2026
0bc3265
feat(app): update the window icon and Windows taskbar resources
Ezreal-byte Nov 21, 2026
a6ae841
fix(linux): compose through Fcitx 4 as well as IBus
t8y2 Nov 21, 2026
8a48f17
feat(ui): drive themed controls from the engine and check attributes …
t8y2 Nov 21, 2026
2b8c415
feat(ui): size Tabs padding, Table type and Checkbox boxes from the e…
t8y2 Nov 21, 2026
913e2dc
fix(list): include row margins in scrollable content height
403bug Nov 21, 2026
bf2b2dd
fix(platform): draw long lines from windows of their texture
xiaoyumuxi Nov 21, 2026
dd53d6d
fix(linux): raise windows with X11 activation timestamps
Ezreal-byte Nov 21, 2026
c242c1b
fix(windows): keep live resize paced by the timer alone
DeanCen Nov 21, 2026
ee29742
feat(base): highlight search matches in shaped text
Ezreal-byte Nov 21, 2026
4a13331
feat(linux): preview X11 drags in a transparent window
Ezreal-byte Nov 21, 2026
1fd4b51
test(linux): allow linear sampling in the Vulkan wide-label test
t8y2 Nov 21, 2026
28ce9e6
merge: sync upstream Viva 1fd4b51b into fork main
1lck Nov 21, 2026
59a696e
feat(platform): round and fade images and expose progress bars
t8y2 Nov 21, 2026
4f8466c
test(darwin): compare Dock icon colors across display profiles
1lck Nov 21, 2026
1d6810a
merge: sync upstream Viva 59a696ec into fork main
1lck Nov 21, 2026
288c224
merge: make the native Dock icon test display-profile independent
1lck Nov 21, 2026
9bb305b
test(windows): check the frame shader layout with image shaping
1lck Nov 21, 2026
f72f292
merge: cover the updated Windows frame shader ABI
1lck Nov 21, 2026
4a007bc
test(darwin): check the Dock icon size in points
1lck Nov 21, 2026
1fd17f2
merge: verify Dock icon size independently of display scale
1lck Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,42 @@ jobs:
- name: API discipline
run: go run ./tools/apicheck ./ui ./components ./app ./gfx

# The attribute rules (ADR 0089 stage 3) exist only in the dev build: they
# report a generic attribute that an element cannot use instead of letting it
# be silently ignored. The release build must not carry the rules or their
# messages, so this job tests the dev variant and proves the release one has
# neither.
dev-attributes:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: vet the dev build
run: go vet -tags dev ./...
- name: test the dev build
run: go test -tags dev ./base ./ui ./components -count=1
- name: prove the release build has no attribute rules
run: |
if go list -f '{{.GoFiles}}' ./base | grep -q attrcheck_dev.go; then
echo "the release build compiles the dev attribute rules" >&2
exit 1
fi
go build -o /tmp/base-release.a ./base
if grep -aq 'does not support' /tmp/base-release.a; then
echo "the release build carries the dev attribute messages" >&2
exit 1
fi
go build -tags dev -o /tmp/base-dev.a ./base
if ! grep -aq 'does not support' /tmp/base-dev.a; then
echo "the dev build does not carry the attribute rules" >&2
exit 1
fi

# Every target Viva ships for must at least type-check, tests included. The
# targets do not depend on each other, so they run at the same time on one
# runner: asking for four runners to do what one can finish in the same minute
Expand Down Expand Up @@ -125,14 +161,21 @@ jobs:
# The Linux package is not part of the sharded run (it drives X11), so the
# titlebar contracts that do not need a server name their tests here.
- name: Titlebar and window contracts
run: go test ./internal/platform/linux -run '^TestMaximizeButtonSetsBothDirections$' -count=1 -v
run: go test ./internal/platform/linux -run '^Test(MaximizeButtonSetsBothDirections|PreviewMovePreservesSizeAndFocus)$' -count=1 -v
- name: Native X11 drag preview
env:
VIVA_TEST_PREVIEW_XVFB: '1'
run: |
sudo apt-get install -y xvfb libxcb-shape0 ||
{ sudo apt-get update && sudo apt-get install -y xvfb libxcb-shape0; }
xvfb-run -a go test ./internal/platform/linux -run '^TestPreviewNativeX11Contract$' -count=1 -v
- name: Native X11 global shortcut
env:
VIVA_NATIVE_GLOBAL_SHORTCUT_TEST: '1'
run: |
sudo apt-get install -y xvfb xdotool libx11-xcb1 ||
{ sudo apt-get update && sudo apt-get install -y xvfb xdotool libx11-xcb1; }
xvfb-run -a go test ./internal/platform/linux -run '^TestNativeX11GlobalShortcut$' -count=1 -v
xvfb-run -a go test ./internal/platform/linux -run '^TestNativeX11(GlobalShortcut|WindowIconPropertyUpdates)$' -count=1 -v

# The browser target is a release target: it compiles every package, runs the
# shared tests under GOOS=js, and builds the browser entry points and a guide.
Expand Down Expand Up @@ -304,6 +347,8 @@ jobs:
run: go test ./internal/platform/windows ./ui ./components ./headless ./app -run 'Test(Backdrop|WindowBackdrop|Notification|TaskbarCreated|CompositionClear|CompositionFallback|CompositionCreation|CustomBackdrop|AcrylicAccent|LegacyAcrylic|RoundedOutline|Translucent|MonospaceFamilies|FontWeights|(The)?MonoWeights|(The)?InterfaceWeights|EveryListedFamilyResolves|EngineReportsTheFontsUnderline|AlwaysOnTop|SaveDialogCheckbox|FileIcon|NativeStructureABI|ResizePresents|WindowSwapChain|LiveResize|FlipWindowResize|RedrawWaits|ContinuousRedraw|NoOpFrame|SameSize|ZeroSize|ResizeTimer|RedrawQueue|NativeRedrawMessage|CompositionSupersededFrame|DragPreview)' -count=1 -v
- name: Terminal keyboard routing
run: go test ./internal/platform/windows -run '^TestATerminalGetsEditingKeysAndChordsAsRawKeys$' -count=1 -v
- name: Native window and grouped taskbar icons
run: go test ./internal/platform/windows -run '^TestWindowIconUpdatesOnTheWindowThread$' -count=1 -v
- name: Native Windows global shortcut
env:
VIVA_NATIVE_GLOBAL_SHORTCUT_TEST: '1'
Expand Down Expand Up @@ -372,7 +417,7 @@ jobs:
passed:
name: ci passed
if: always()
needs: [changes, lint, cross-vet, web, web-browser, test, darwin, windows-materials, windows-arm64-text, benchmarks]
needs: [changes, lint, dev-attributes, cross-vet, web, web-browser, test, darwin, windows-materials, windows-arm64-text, benchmarks]
runs-on: ubuntu-latest
steps:
- name: every job this change needed passed
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ WebView and no bundled rendering runtime.
- Focus-driven dynamic native text editors on macOS, Windows, and Linux, with
explicit enable/replace/disable frame updates. macOS and Windows caret timers
exist only while an editable field is focused. Linux composes through the IBus
protocol (IBus and Fcitx5's IBus frontend); XIM is still open.
protocol (IBus and Fcitx5's IBus frontend) or Fcitx 4's own protocol; XIM is
still open.
- A separate retained semantic accessibility tree.
- Direct CoreText shaping, system-font fallback, GPU-composited text textures,
and a bounded measurement cache.
Expand Down
2 changes: 2 additions & 0 deletions app/accessnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ func accessRole(role semantic.Role) gfx.Role {
return gfx.RoleStatus
case semantic.RoleSeparator:
return gfx.RoleSeparator
case semantic.RoleProgress:
return gfx.RoleProgressBar
}
return 0
}
9 changes: 9 additions & 0 deletions app/application_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var _ fullscreenControl = resultWindow{}
var _ alwaysOnTopControl = resultWindow{}
var _ shortcutCapturer = resultWindow{}
var _ titleControl = resultWindow{}
var _ windowIconControl = resultWindow{}
var _ platform.WindowMover = resultWindow{}

// What OpenWindow looks for in a host's window control.
Expand Down Expand Up @@ -125,6 +126,14 @@ func (window resultWindow) SetTitle(title string) error {
return control.SetTitle(title)
}

func (window resultWindow) SetIcon(icon WindowIcon) error {
control, ok := window.WindowControl.(platform.WindowIconSetter)
if !ok {
return fmt.Errorf("%w: window icons", ErrUnsupported)
}
return control.SetIcon(icon.platform())
}

func (window resultWindow) SetAlwaysOnTop(enabled bool) error {
control, ok := window.WindowControl.(alwaysOnTopControl)
if !ok {
Expand Down
7 changes: 6 additions & 1 deletion app/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,11 @@ type Label struct {
BitmapStride int
BitmapID uint64
BitmapVersion uint32
BitmapUpload bool
// ImageRadius and ImageFade are platform.TextLabel's: the corners of an
// image and how much of it is transparent.
ImageRadius float32
ImageFade float32
BitmapUpload bool
// Quad, while HasQuad, is where the label's picture lands: four corners in
// logical pixels with the colour multiplied into each, as gfx.Canvas.LabelQuad
// draws it. Bounds stays the box the picture was rasterised in.
Expand Down Expand Up @@ -1237,6 +1241,7 @@ func (driver *Driver) Snapshot() Snapshot {
Clip: label.Clip, Clipped: label.Clipped,
BitmapWidth: label.BitmapWidth, BitmapHeight: label.BitmapHeight, BitmapStride: label.BitmapStride,
BitmapID: label.BitmapID, BitmapVersion: label.BitmapVersion,
ImageRadius: label.ImageRadius, ImageFade: label.ImageFade,
BitmapUpload: label.BitmapUpload,
Quad: label.Quad, HasQuad: label.HasQuad,
}
Expand Down
2 changes: 2 additions & 0 deletions app/painter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,8 @@ func semanticRole(role gfx.Role) semantic.Role {
return semantic.RoleStatus
case gfx.RoleSeparator:
return semantic.RoleSeparator
case gfx.RoleProgressBar:
return semantic.RoleProgress
default:
return semantic.RoleButton
}
Expand Down
42 changes: 41 additions & 1 deletion app/window_icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package app

import (
"fmt"
"path/filepath"
"runtime"
"strings"

"github.com/vivaui/viva/internal/platform"
)
Expand All @@ -18,6 +20,40 @@ type WindowIcon struct {
Size int
// RGBA is Size*Size straight (not premultiplied) 8-bit pixels, top row first.
RGBA []byte
// ResourcePath optionally names a persistent, absolute .ico file on Windows.
// With Config.Class set, it also supplies the taskbar group's and newly
// pinned shortcut's icon. The caller owns this file and must keep it after
// exit. Other platforms ignore it. Existing shortcuts are not edited.
ResourcePath string
}

type windowIconControl interface {
SetIcon(WindowIcon) error
}

// SetIcon replaces the running window's title-bar and task-switcher icon. On
// macOS it replaces the application's Dock icon, including in an .app bundle;
// on Windows, see ResourcePath for grouped/pinned taskbar icons; on Wayland the
// compositor may keep the desktop entry's icon. Installed launchers and signed
// application resources are not changed. Calls are safe
// from any goroutine. The pixels are copied before returning. An empty or
// invalid icon changes nothing; unsupported hosts return ErrUnsupported.
func (window *Window) SetIcon(icon WindowIcon) error {
if window == nil || window.closed.Load() {
return fmt.Errorf("app: window is closed")
}
if err := icon.validate(); err != nil {
return err
}
if icon.Size == 0 {
return fmt.Errorf("app: window icon must not be empty")
}
control, ok := window.control.(windowIconControl)
if !ok {
return fmt.Errorf("%w: window icons", ErrUnsupported)
}
icon.RGBA = append([]byte(nil), icon.RGBA...)
return control.SetIcon(icon)
}

// StatusIcon is the picture as a status-area icon of size pixels, in the form
Expand All @@ -36,6 +72,10 @@ func (icon WindowIcon) StatusIcon(size int) StatusIcon {
}

func (icon WindowIcon) validate() error {
if runtime.GOOS == "windows" && icon.ResourcePath != "" &&
(!filepath.IsAbs(icon.ResourcePath) || strings.ContainsRune(icon.ResourcePath, 0)) {
return fmt.Errorf("app: icon resource must be an absolute path without NUL")
}
if icon.Size == 0 && len(icon.RGBA) == 0 {
return nil
}
Expand All @@ -46,5 +86,5 @@ func (icon WindowIcon) validate() error {
}

func (icon WindowIcon) platform() platform.WindowIcon {
return platform.WindowIcon{Size: icon.Size, RGBA: icon.RGBA}
return platform.WindowIcon{Size: icon.Size, RGBA: icon.RGBA, ResourcePath: icon.ResourcePath}
}
76 changes: 76 additions & 0 deletions app/window_icon_update_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//go:build darwin || windows || linux

package app

import (
"errors"
"path/filepath"
"testing"

"github.com/vivaui/viva/internal/platform"
)

type iconTestControl struct {
fakeWindow
icon WindowIcon
}

func (control *iconTestControl) SetIcon(icon WindowIcon) error {
control.icon = icon
return nil
}

func TestWindowIconUpdateValidatesAndCopiesPixels(t *testing.T) {
control := &iconTestControl{}
window := &Window{control: control}
icon := WindowIcon{Size: 1, RGBA: []byte{30, 100, 220, 255}}
if err := window.SetIcon(icon); err != nil {
t.Fatal(err)
}
icon.RGBA[0] = 200
if control.icon.RGBA[0] != 30 {
t.Fatal("the host retained caller-owned pixels")
}
for _, invalid := range []WindowIcon{{}, {Size: 1}, {Size: 1025}} {
if err := window.SetIcon(invalid); err == nil || control.icon.RGBA[0] != 30 {
t.Fatal("an invalid update changed the icon")
}
}
window.closed.Store(true)
if err := window.SetIcon(icon); err == nil {
t.Fatal("a closed window accepted an icon")
}
var missing *Window
if err := missing.SetIcon(icon); err == nil {
t.Fatal("a nil window accepted an icon")
}
if err := (&Window{control: &fakeWindow{}}).SetIcon(icon); !errors.Is(err, ErrUnsupported) {
t.Fatalf("unsupported window: %v", err)
}
}

type nativeIconTestControl struct {
fakeWindow
icon platform.WindowIcon
}

func (control *nativeIconTestControl) SetIcon(icon platform.WindowIcon) error {
control.icon = icon
return nil
}

func TestResultWindowForwardsIconUpdates(t *testing.T) {
native := &nativeIconTestControl{}
window := &Window{control: resultWindow{WindowControl: native}}
resource := filepath.Join(t.TempDir(), "logo.ico")
if err := window.SetIcon(WindowIcon{Size: 1, RGBA: []byte{1, 2, 3, 255}, ResourcePath: resource}); err != nil {
t.Fatal(err)
}
if native.icon.Size != 1 || native.icon.RGBA[2] != 3 || native.icon.ResourcePath != resource {
t.Fatalf("native icon = %+v", native.icon)
}
window = &Window{control: resultWindow{WindowControl: &fakeWindow{}}}
if err := window.SetIcon(WindowIcon{Size: 1, RGBA: make([]byte, 4)}); !errors.Is(err, ErrUnsupported) {
t.Fatalf("wrapped unsupported window: %v", err)
}
}
24 changes: 24 additions & 0 deletions base/accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ func (x *Extra) GetBorder() Color { return x.border }
// GetBorderDashed reads the borderDashed of Extra for the styled painting layer.
func (x *Extra) GetBorderDashed() bool { return x.borderDashed }

// GetSelectColors reads the colors the recipe gave the Select trigger being
// painted, for the styled painting layer.
func (f *Frame) GetSelectColors() (foreground, chevron Color) {
return f.selectForeground, f.selectChevron
}

// GetButtonRecipe reads the buttonRecipe of Extra for the styled painting layer.
func (x *Extra) GetButtonRecipe() func(gfx.Theme, style.Variant, gfx.State) style.ButtonLook {
return x.buttonRecipe
Expand Down Expand Up @@ -383,6 +389,14 @@ func (x *Frame) GetAddons() []FieldAddons { return x.addons }
// GetBounds reads the bounds of Frame for the styled painting layer.
func (x *Frame) GetBounds() Rect { return x.bounds }

// GetCheckboxLook reads the look the recipe gave the checkbox box being
// painted, for the styled painting layer's mark.
func (f *Frame) GetCheckboxLook() style.CheckboxLook { return f.checkboxPainted }

// GetSwitchLook reads the look the recipe gave the switch being painted, for the
// styled painting layer's thumb.
func (f *Frame) GetSwitchLook() style.SwitchLook { return f.switchPainted }

// GetCaptionFn reads the captionFn of Frame for the styled painting layer.
func (x *Frame) GetCaptionFn() func(f *Frame, n *Node, control Rect) { return x.captionFn }

Expand Down Expand Up @@ -1172,6 +1186,16 @@ func (x *TableDecl) GetRows() int { return x.rows }
// GetSpec reads the spec of TableDecl for the styled painting layer.
func (x *TableDecl) GetSpec() TableSpec { return x.spec }

// GetFontSize reads the element's font size for the table being painted: the
// explicit size when it has one, else the spec's.
func (x *TableDecl) GetFontSize() float32 { return x.fontSize }

// GetForeground reads the element's text color for the table being painted.
func (x *TableDecl) GetForeground() gfx.Color { return x.foreground }

// GetForegroundSet reports whether the element set a text color of its own.
func (x *TableDecl) GetForegroundSet() bool { return x.hasForeground }

// GetState reads the state of TableDecl for the styled painting layer.
func (x *TableDecl) GetState() *TableState { return x.state }

Expand Down
Loading
Loading