feat: port the client to MyGo native UI (0.3.0)
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.
This commit is contained in:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
+49
@@ -0,0 +1,49 @@
|
||||
// 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
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package pacing
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestSetting checks the values of MYGO_UNCAPPED: those that turn it on,
|
||||
// those that leave it off, and mistakes, which leave frames paced.
|
||||
func TestSetting(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
v string
|
||||
want bool
|
||||
}{
|
||||
{"", false}, {"0", false}, {"false", false}, {"off", false}, {"No", false},
|
||||
{"1", true}, {"true", true}, {" on ", true}, {"YES", true},
|
||||
{"2", false}, {"uncapped", false},
|
||||
} {
|
||||
if got := Setting(tc.v); got != tc.want {
|
||||
t.Errorf("Setting(%q) = %v, want %v", tc.v, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestUncappedIgnoredInBrowsers checks that browsers, whose
|
||||
// requestAnimationFrame cannot be uncapped, stay paced, and that the
|
||||
// desktop platforms take the setting.
|
||||
func TestUncappedIgnoredInBrowsers(t *testing.T) {
|
||||
if uncapped("1", "js") {
|
||||
t.Error("uncapped in a browser")
|
||||
}
|
||||
for _, goos := range []string{"darwin", "linux", "windows"} {
|
||||
if !uncapped("1", goos) || uncapped("0", goos) || uncapped("", goos) {
|
||||
t.Errorf("%s does not take MYGO_UNCAPPED as it is", goos)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user