Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
50 lines
1.9 KiB
Go
50 lines
1.9 KiB
Go
// Package pacing tells whether frames of native UI wait for the display.
|
|
//
|
|
// They do, unless MYGO_UNCAPPED asks otherwise: a frame that follows another
|
|
// draws at the display's next refresh, as the display link, GTK's frame
|
|
// clock or the swap chain's room says, and so every scene cheaper than a
|
|
// refresh shows the display's rate. Uncapped, as benchmarks, profilers and
|
|
// apps that want the least latency ask for, the next frame starts as soon
|
|
// as the last was presented, and the frame rate tells how much of a refresh
|
|
// a scene leaves. An idle window still draws nothing: only the frames asked
|
|
// for come sooner. The window host (package ui), the backends and the GPU
|
|
// renderers read Uncapped, each where it waits for the display; "Frame
|
|
// pacing" in docs/ui/rendering.md tells what each platform does.
|
|
package pacing
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// Uncapped tells that MYGO_UNCAPPED asked frames to present without
|
|
// waiting for the display. It is read once, as the program starts; in
|
|
// browsers, whose requestAnimationFrame paces frames and nothing presents
|
|
// sooner, it stays false. Tests set it.
|
|
var Uncapped = uncapped(os.Getenv("MYGO_UNCAPPED"), runtime.GOOS)
|
|
|
|
func uncapped(v, goos string) bool {
|
|
on := Setting(v)
|
|
if on && goos == "js" {
|
|
log.Print("mygo: MYGO_UNCAPPED has no effect in browsers, whose requestAnimationFrame paces frames at the display's rate")
|
|
return false
|
|
}
|
|
return on
|
|
}
|
|
|
|
// Setting reports whether v, MYGO_UNCAPPED's value, asks for frames
|
|
// uncapped: 1 (or true, on, yes) does, and nothing, 0 (false, off, no) does
|
|
// not. Another value is a mistake, logged, which leaves frames paced.
|
|
func Setting(v string) bool {
|
|
switch strings.ToLower(strings.TrimSpace(v)) {
|
|
case "", "0", "false", "off", "no":
|
|
return false
|
|
case "1", "true", "on", "yes":
|
|
return true
|
|
}
|
|
log.Printf("mygo: MYGO_UNCAPPED=%q is neither 1 nor 0: frames stay paced by the display", v)
|
|
return false
|
|
}
|