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:
OpenChamber committed 2026-11-18 13:22:59 +08:00
1 parent 2fb4a8ea79
commit 6c0ee61750
2538 files changed
+675779 -4792

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
//go:build linux && !android && (amd64 || arm64)
package gl
import (
"sync"
"unsafe"
"github.com/ebitengine/purego"
)
// GLX's functions UnsyncGLXSwaps calls, through libepoxy's pointers, as GDK
// calls them; nil where libepoxy has no GLX.
var glx struct {
once sync.Once
currentDisplay *uintptr // glXGetCurrentDisplay
currentContext *uintptr // glXGetCurrentContext
currentDrawn *uintptr // glXGetCurrentDrawable
queryContext *uintptr // glXQueryContext
intervalEXT *uintptr // glXSwapIntervalEXT
intervalMESA *uintptr // glXSwapIntervalMESA
hasExtension func(dpy uintptr, screen int32, ext string) bool
}
// glxScreen is GLX_SCREEN, which glXQueryContext tells.
const glxScreen = 0x800C
// UnsyncGLXSwaps sets the swap interval of the GLX drawable current to 0,
// so that its swaps wait for no vertical blank, for frames uncapped
// (MYGO_UNCAPPED): the backend calls it as GDK paints a window it
// composites with OpenGL on X11, with the window's paint context current.
// GDK sets 1 there on a display without a compositor, which holds frames
// to the display's refreshes, and 0 under a compositor, which paces the
// window itself (gdk/x11/gdkglcontext-x11.c); GDK's EGL, on Wayland, swaps
// with 0 already. It sets the interval with GLX_EXT_swap_control, else
// GLX_MESA_swap_control (GLX_SGI_swap_control takes no 0), and does
// nothing without either, or without a context current. GDK sets its own
// interval again only when a compositor starts or stops, so a call each
// paint keeps 0, which costs nothing once set.
func UnsyncGLXSwaps() {
if load() != nil {
return
}
g := &glx
g.once.Do(func() {
lib, err := purego.Dlopen("libepoxy.so.0", purego.RTLD_NOW|purego.RTLD_GLOBAL)
if err != nil {
return
}
ptr := func(name string) *uintptr {
sym, err := purego.Dlsym(lib, "epoxy_"+name)
if err != nil || sym == 0 {
return nil
}
return *(**uintptr)(unsafe.Pointer(&sym))
}
if sym, err := purego.Dlsym(lib, "epoxy_has_glx_extension"); err == nil && sym != 0 {
purego.RegisterFunc(&g.hasExtension, sym)
}
g.currentDisplay, g.currentContext, g.currentDrawn = ptr("glXGetCurrentDisplay"), ptr("glXGetCurrentContext"), ptr("glXGetCurrentDrawable")
g.queryContext, g.intervalEXT, g.intervalMESA = ptr("glXQueryContext"), ptr("glXSwapIntervalEXT"), ptr("glXSwapIntervalMESA")
})
if g.hasExtension == nil || g.currentDisplay == nil || g.currentContext == nil || g.currentDrawn == nil || g.queryContext == nil {
return
}
dpy, _, _ := purego.SyscallN(*g.currentDisplay)
ctx, _, _ := purego.SyscallN(*g.currentContext)
drawable, _, _ := purego.SyscallN(*g.currentDrawn)
if dpy == 0 || ctx == 0 || drawable == 0 {
return
}
var screen int32
if r, _, _ := purego.SyscallN(*g.queryContext, dpy, ctx, glxScreen, uintptr(unsafe.Pointer(&screen))); r != 0 {
return // not Success
}
switch {
case g.intervalEXT != nil && g.hasExtension(dpy, screen, "GLX_EXT_swap_control"):
purego.SyscallN(*g.intervalEXT, dpy, drawable, 0)
case g.intervalMESA != nil && g.hasExtension(dpy, screen, "GLX_MESA_swap_control"):
purego.SyscallN(*g.intervalMESA, 0)
}
}