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
08fe87e
fix(proxy): wake PAC evaluation on cancel instead of polling
Ezreal-byte Nov 23, 2026
271c747
fix(ci): report every release size before failing the budget
caichangqing1120 Nov 23, 2026
4cfdcb2
perf(platform): keep WebKit partition hashing on macOS
caichangqing1120 Nov 23, 2026
b61a174
fix(linux): hit the clicked cluster edge in bidirectional text
caichangqing1120 Nov 23, 2026
6b610b9
feat(android): show the system's selection handles, magnifier and menu
t8y2 Nov 23, 2026
292db86
fix(linux): read X11 clipboard by TARGETS and refresh stale ownership
Ezreal-byte Nov 23, 2026
12d2ffd
fix(components): cap a dropdown menu at its explicit max width
Ezreal-byte Nov 23, 2026
9d16c22
feat(base): add italic and strike to Text
MYCF711 Nov 23, 2026
20d8880
feat(components): let a dropdown menu choose its row height
MYCF711 Nov 23, 2026
eac8721
feat(linux): notify clipboard changes on X11
caichangqing1120 Nov 23, 2026
03fff4c
fix(linux): announce focus on newly added accessibility controls
caichangqing1120 Nov 23, 2026
86ab850
fix(window): keep the notification window on screen and let it move
Ezreal-byte Nov 23, 2026
00a17fe
feat(ios): use the system's text interaction on a focused text field
t8y2 Nov 23, 2026
010dc54
fix(ui): keep panel wheel events off the page underneath
xiaoyumuxi Nov 23, 2026
7ea3984
feat(ui): add textview, read-only text that selects and copies
xiaoyumuxi Nov 23, 2026
72907e8
fix(linux): paint X11 windows without waiting for input and after re-…
Ezreal-byte Nov 23, 2026
974ef45
fix(android): keep typing in order when the keyboard reopens a word
t8y2 Nov 23, 2026
f0ca028
feat(back): let an application take the back button and the edge swipe
t8y2 Nov 23, 2026
f56612f
feat(touch): tell an application when two fingers pinch
t8y2 Nov 23, 2026
471ea7a
refactor: move the phone backends to the mobile branch
t8y2 Nov 23, 2026
b7ac8d7
Merge remote-tracking branch 'upstream/main' into sync/upstream-471ea7ab
1lck Nov 23, 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
27 changes: 11 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ jobs:
wait "$pid" || status=1
done
exit "$status"
# The Android build is the real thing: the program as a shared library with
# the NDK's compiler, the host's Java, and an APK around them with the SDK's
# tools, all of which the runner's image has. It is not run here; the
# runner has no device.
- name: Android build
run: |
export ANDROID_HOME="${ANDROID_HOME:-/usr/local/lib/android/sdk}"
export ANDROID_NDK_HOME="${ANDROID_NDK_HOME:-$(ls -d "$ANDROID_HOME"/ndk/* | sort -V | tail -1)}"
go run ./cmd/viva build --target android ./examples/guides/hello
go run ./cmd/viva build --target android --arch amd64 ./examples/guides/hello
- name: Native Linux text rasterization
run: |
sudo apt-get install -y libpangocairo-1.0-0 fonts-noto-color-emoji ||
Expand All @@ -184,7 +174,7 @@ jobs:
run: |
sudo apt-get install -y xvfb libxcb-shape0 libgtk-3-0 ||
{ sudo apt-get update && sudo apt-get install -y xvfb libxcb-shape0 libgtk-3-0; }
xvfb-run -a go test ./internal/platform/linux -run '^Test(PreviewNativeX11Contract|NotificationNativeX11)$' -count=1 -v
xvfb-run -a -s '-screen 0 1280x1024x24 -noreset' go test ./internal/platform/linux -run '^Test(PreviewNativeX11Contract|NotificationNativeX11|TrayWindowQueuedRedrawBeforeInput|TrayWindowRepaintsLaterExposure)$' -count=1 -v
GDK_BACKEND=x11 VIVA_TEST_GTK_NOTIFICATION=1 xvfb-run -a go test -tags vivagtk ./internal/platform/linux -run '^TestGTKNotificationFocusHints$' -count=1 -v
- name: Native X11 global shortcut
env:
Expand All @@ -193,6 +183,16 @@ jobs:
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 '^TestNativeX11(GlobalShortcut|WindowIconPropertyUpdates)$' -count=1 -v
- name: Native X11 clipboard formats and ownership
run: |
sudo apt-get install -y xclip python3-gi gir1.2-gtk-3.0 ||
{ sudo apt-get update && sudo apt-get install -y xclip python3-gi gir1.2-gtk-3.0; }
env -u WAYLAND_DISPLAY GDK_BACKEND=x11 VIVA_LINUX_XCB_SMOKE=1 \
xvfb-run -a -s '-screen 0 1280x1024x24 -noreset' \
go test ./internal/platform/linux -run '^TestClipboardImage(FromX11Owner|AfterExternalOwnerReplacesCachedText|StreamedWithINCR)$|^TestX11ClipboardChangeLifecycle$' -count=1 -timeout=60s -v
env -u WAYLAND_DISPLAY GDK_BACKEND=x11 VIVA_TEST_GTK_CLIPBOARD_WATCH=x11 \
xvfb-run -a -s '-screen 0 1280x1024x24 -noreset' \
go test -tags vivagtk ./internal/platform/linux -run '^TestGTKClipboardChangeNative$' -count=1 -timeout=60s -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 @@ -350,11 +350,6 @@ jobs:
VIVA_NATIVE_GLOBAL_SHORTCUT_TEST: '1'
run: go test ./internal/platform/darwin -run '^TestNativeCarbonGlobalShortcut$' -count=1 -v

# The iOS build compiles the Metal and UIKit bridge against the simulator
# SDK; it is not run here, since the runner cannot show a simulator.
- name: iOS simulator build
run: go run ./cmd/viva build --target ios-sim ./examples/guides/hello



windows-materials:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@

# A signing key written by viva update-keygen in the project root.
/update.key
tools/android/local.sh
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ WebView and no bundled rendering runtime.
- `app/proxy.SystemProxy` reports the proxy the desktop selects for an HTTP URL:
CFNetwork on macOS, WinHTTP's automatic proxy on Windows (PAC, WPAD and the
static settings), and the environment on Linux. A policy the platform cannot
evaluate is an error, never a silent direct connection.
evaluate is an error, never a silent direct connection. `SystemProxyContext`
lets a request cancel macOS PAC downloads and evaluation; both entry points
bound PAC work to ten seconds.
- `gfx.MonoFamily` draws fixed-pitch text in any installed family and
`app.MonospaceFamilies` lists them.
- `Config.OnFileDrop` receives files dragged from the file manager, with the hit
Expand Down
34 changes: 13 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const (
// WindowNotification opens a desktop popup that accepts pointer input and
// stays open when focus changes. On Windows, macOS and X11 it requests the
// bottom-right of the pointer monitor's work area without taking keyboard
// focus. On native Wayland, the compositor decides placement, stacking and
// focus. Mark the parts the user may drag with gfx.Canvas.MoveRegion or
// ui.Box.MovesWindow and save Frame's X and Y for Config.Origin.
// On native Wayland, the compositor decides placement, stacking and
// keyboard focus. Use SendNotification for a system-managed notification.
WindowNotification WindowMode = WindowMode(platform.WindowNotification)
)
Expand Down Expand Up @@ -78,7 +80,10 @@ type Config struct {
// system. It is a request: on Windows and macOS the content area lands there
// (kept on a screen); an X11 window manager places the window's frame there,
// so the content area sits below the title bar. Window.Frame reports where it
// really is.
// really is. WindowNotification restores to the nearest available monitor
// and clamps to its work area. On Windows a notification's origin is in
// physical desktop pixels, matching Frame's X and Y across mixed-DPI
// displays. A Wayland compositor may ignore the requested position.
Origin *gfx.Point
// Maximized asks the window manager to open the window maximized on Windows
// and Linux, while keeping Width, Height and Origin as its restored floating
Expand Down Expand Up @@ -226,12 +231,12 @@ type Config struct {
// application stop work nobody can see, such as a remote desktop stream.
// Hide is the application's own request and is not reported here.
OnMinimize func(minimized bool)
// OnLifecycle runs on the window thread when the system moves a phone application
// between the foreground and the background, or asks it for memory. A desktop window
// never gets one. A phone may end a backgrounded application without further notice, so
// Background is when to save what the user would miss; a MemoryWarning is when to drop
// caches that can be rebuilt.
OnLifecycle func(LifecycleEvent)
// OnPinch receives two fingers pinching the window: its begin, each change and its end.
// Only a touch screen and a touchpad that can pinch send them; the event says where the
// fingers are, how far apart they are against the start and since the last event, and the
// hit under them. Handled keeps the pinch from doing anything else (nothing does by
// default), and Repaint asks for a frame.
OnPinch func(event gfx.PinchEvent) gfx.EventResult
// OnActivate runs on the window thread when the top-level window becomes
// the active window, including when the user switches back from another
// application. Moving focus between editors inside the window does not
Expand Down Expand Up @@ -360,16 +365,3 @@ func (config Config) originPoint() gfx.Point {
}
return *config.Origin
}

// LifecycleEvent is a change the system makes to the state of a phone application (see
// Config.OnLifecycle).
type LifecycleEvent uint8

const (
// LifecycleBackground says the application went behind another.
LifecycleBackground LifecycleEvent = iota + 1
// LifecycleForeground says it came back to the front.
LifecycleForeground
// LifecycleMemoryWarning says the system wants memory back.
LifecycleMemoryWarning
)
2 changes: 2 additions & 0 deletions app/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func (window *Window) Show() {
// application's windows finds it by comparing its pointer with their frames. The
// result is false for a closed window. On displays of different scale the
// coordinates of windows on different displays are only approximately comparable.
// On Windows a WindowNotification reports X and Y in physical desktop pixels,
// suitable for saving and restoring with Config.Origin. Its size is still logical.
// It may be called from any goroutine.
func (window *Window) Frame() (gfx.Rect, bool) {
if window == nil || window.control == nil || window.closed.Load() {
Expand Down
13 changes: 0 additions & 13 deletions app/backend_android.go

This file was deleted.

13 changes: 0 additions & 13 deletions app/backend_ios.go

This file was deleted.

19 changes: 0 additions & 19 deletions app/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,25 +293,6 @@ func (driver *Driver) Resize(width, height int) error {
return err
}

// Lifecycle tells the application the system did something to it, as a phone does when it
// moves the application to the background or asks it for memory.
func (driver *Driver) Lifecycle(event LifecycleEvent) {
if driver.config.OnLifecycle != nil {
driver.config.OnLifecycle(event)
}
}

// SetSafeArea says the system covers the window's edges by insets, as a phone's status bar,
// sensor housing and home indicator do, and lets the page lay out again inside what is left.
func (driver *Driver) SetSafeArea(insets gfx.Insets) error {
if err := driver.Pump(); err != nil {
return err
}
size := driver.painter.size
_, err := driver.painter.resize(platform.Size{Width: size.Width, Height: size.Height, Scale: driver.painter.scale, SafeArea: insets})
return err
}

func (driver *Driver) pointer(kind platform.PointerEventKind, x, y float32, button gfx.PointerButton, clicks int) error {
if err := driver.Pump(); err != nil {
return err
Expand Down
9 changes: 0 additions & 9 deletions app/ios_unsupported.go

This file was deleted.

62 changes: 0 additions & 62 deletions app/mobile_unsupported.go

This file was deleted.

24 changes: 20 additions & 4 deletions app/painter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
// native label list, so an unchanged repaint performs no renderer work.
type painter struct {
fullscreen bool
// safeArea is how far the system covers the window's edges, as the platform last said.
safeArea gfx.Insets
// touch reads a finger's presses, pans and flings (touch.go).
touch touchState
// customTitlebar says the page draws the window's titlebar strip itself
Expand All @@ -38,6 +36,7 @@ type painter struct {
onShortcut func(gfx.KeyEvent) gfx.EventResult
captureMenuKeys func() bool
onScroll func(gfx.ScrollEvent) gfx.EventResult
onPinch func(gfx.PinchEvent) gfx.EventResult
// onModifierTap and tap recognize a modifier pressed and released on its own.
onModifierTap func(gfx.ModifierTapEvent) gfx.EventResult
// onFocusLost hears that the window lost the keyboard (Config.OnFocusLost).
Expand Down Expand Up @@ -164,6 +163,7 @@ func newPainterWithClock(canvas *gfx.Canvas, config *Config, clock func() time.D
onShortcut: config.OnShortcut,
captureMenuKeys: config.CaptureMenuKeys,
onScroll: config.OnScroll,
onPinch: config.OnPinch,
onModifierTap: config.OnModifierTap,
onFocusLost: config.OnFocusLost,
onFileDrop: config.OnFileDrop,
Expand Down Expand Up @@ -213,7 +213,7 @@ func newPainterWithClock(canvas *gfx.Canvas, config *Config, clock func() time.D
func (painter *painter) resize(size platform.Size) (platform.Frame, error) {
next := gfx.Size{Width: size.Width, Height: size.Height}
changed := next != painter.size
painter.size, painter.scale, painter.safeArea = next, size.Scale, size.SafeArea
painter.size, painter.scale = next, size.Scale
if changed && painter.onResize != nil {
painter.onResize(next)
}
Expand Down Expand Up @@ -855,6 +855,23 @@ func (painter *painter) scroll(event platform.ScrollEvent) (platform.Frame, erro
// applyScroll gives a scroll to the application, or scrolls the page itself when
// the application leaves it, and reports whether anything changed that needs a
// repaint.
// applyPinch gives the application a pinch and reports whether the page is to be painted
// again. A pinch nobody listens to changes nothing.
func (painter *painter) applyPinch(phase gfx.PinchPhase, x, y, scale, delta float32, modifiers input.Modifiers) bool {
if painter.onPinch == nil {
return false
}
target := gfx.ID{}
if hit, ok := painter.focus.Router().HitTest(x, y); ok {
target = hit
}
response := painter.onPinch(gfx.PinchEvent{
Phase: phase, Modifiers: gfx.Modifiers(modifiers), X: x, Y: y, Scale: scale, Delta: delta,
Viewport: painter.size, Target: target,
})
return painter.applyEventResult(response) || response.Repaint
}

func (painter *painter) applyScroll(event platform.ScrollEvent) bool {
if event.DeltaY == 0 && event.DeltaX == 0 && event.Phase != gfx.ScrollPhaseEnd {
return false
Expand Down Expand Up @@ -1060,7 +1077,6 @@ func (painter *painter) paintCanvas() {
painter.canvas.SetHoveredRole(painter.pointer.HoveredRole())
painter.canvas.SetPointerOnSurface(painter.onSurface)
painter.canvas.SetTitlebarInsets(painter.titlebarInsets())
painter.canvas.SetSafeArea(painter.safeArea)
painter.canvas.SetScroll(painter.scrollX, painter.scrollY)
painter.canvas.BeginFrame()
painter.paint(painter.canvas, painter.size)
Expand Down
5 changes: 3 additions & 2 deletions app/proxy/native_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
package proxy

import (
"context"
"errors"
"fmt"
"net/url"

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

func nativeSystemProxy(target *url.URL) (*url.URL, error) {
proxy, err := darwinplatform.SystemProxy(target.String())
func nativeSystemProxy(ctx context.Context, target *url.URL) (*url.URL, error) {
proxy, err := darwinplatform.SystemProxyContext(ctx, target.String())
if errors.Is(err, darwinplatform.ErrProxyUnavailable) {
return nil, fmt.Errorf("%w: %v", errSystemProxyUnavailable, err)
}
Expand Down
7 changes: 5 additions & 2 deletions app/proxy/native_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

package proxy

import "net/url"
import (
"context"
"net/url"
)

func nativeSystemProxy(*url.URL) (*url.URL, error) { return nil, ErrUnavailable }
func nativeSystemProxy(context.Context, *url.URL) (*url.URL, error) { return nil, ErrUnavailable }
7 changes: 5 additions & 2 deletions app/proxy/native_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

package proxy

import "net/url"
import (
"context"
"net/url"
)

// nativeSystemProxy is the environment, which SystemProxy has already read:
// Linux desktops that keep a proxy in GSettings do not export it, and asking
// them would mean starting a session-bus or GIO connection for a setting most
// programs do not read. A system proxy configured there is not reported.
func nativeSystemProxy(*url.URL) (*url.URL, error) { return nil, nil }
func nativeSystemProxy(context.Context, *url.URL) (*url.URL, error) { return nil, nil }
7 changes: 5 additions & 2 deletions app/proxy/native_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

package proxy

import "net/url"
import (
"context"
"net/url"
)

func nativeSystemProxy(*url.URL) (*url.URL, error) { return nil, ErrUnavailable }
func nativeSystemProxy(context.Context, *url.URL) (*url.URL, error) { return nil, ErrUnavailable }
Loading
Loading