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

+78
View File
@@ -0,0 +1,78 @@
//go:build windows && (amd64 || arm64)
package windows
import (
"testing"
"unsafe"
"github.com/egoist/mygo/internal/platform"
)
// The pointer structs are laid out as Windows's headers lay them out on
// 64-bit Windows.
func TestPointerInfoLayout(t *testing.T) {
if n := unsafe.Sizeof(pointerInfo{}); n != 96 {
t.Errorf("POINTER_INFO is %d bytes, want 96", n)
}
if n := unsafe.Sizeof(pointerPenInfo{}); n != 120 {
t.Errorf("POINTER_PEN_INFO is %d bytes, want 120", n)
}
if n := unsafe.Sizeof(pointerTouchInfo{}); n != 144 {
t.Errorf("POINTER_TOUCH_INFO is %d bytes, want 144", n)
}
if o := unsafe.Offsetof(pointerInfo{}.PerformanceCount); o != 80 {
t.Errorf("PerformanceCount at %d, want 80", o)
}
if o := unsafe.Offsetof(pointerPenInfo{}.Pressure); o != 104 {
t.Errorf("POINTER_PEN_INFO's pressure at %d, want 104", o)
}
if o := unsafe.Offsetof(pointerTouchInfo{}.Pressure); o != 140 {
t.Errorf("POINTER_TOUCH_INFO's pressure at %d, want 140", o)
}
if o := unsafe.Offsetof(pointerTouchInfo{}.Contact); o != 104 {
t.Errorf("POINTER_TOUCH_INFO's rcContact at %d, want 104", o)
}
}
// A finger's contact is the size of rcContact, where the touchscreen tells
// it (TOUCH_MASK_CONTACTAREA), as a palm erasing a whiteboard (#1879).
func TestTouchContact(t *testing.T) {
info := pointerTouchInfo{Contact: rect{Left: 100, Top: 200, Right: 160, Bottom: 290}}
if w, h := touchContact(&info); w != 0 || h != 0 {
t.Errorf("no contact area in the mask: %d x %d, want 0 x 0", w, h)
}
info.Mask = touchMaskContactArea | touchMaskPressure
if w, h := touchContact(&info); w != 60 || h != 90 {
t.Errorf("contact %d x %d, want 60 x 90", w, h)
}
}
// The cursors Windows lacks are drawn: opaque in the middle, transparent
// at the corners, at the cursor sizes of high DPIs too.
func TestDrawnCursors(t *testing.T) {
for _, c := range []platform.Cursor{platform.CursorZoomIn, platform.CursorZoomOut, platform.CursorCell} {
for _, size := range []int{32, 48, 64} {
and, xor, hx, hy := cursorMasks(c, size)
if len(and) != size*size/8 || len(xor) != len(and) {
t.Fatalf("cursor %d at %d: masks of %d and %d bytes", c, size, len(and), len(xor))
}
bit := func(m []byte, x, y int) bool { return m[y*size/8+x/8]&(0x80>>(x%8)) != 0 }
if !bit(and, 0, 0) || !bit(and, size-1, 0) || bit(xor, 0, 0) {
t.Errorf("cursor %d at %d: a corner is not transparent", c, size)
}
if bit(and, hx, hy) {
t.Errorf("cursor %d at %d: its hot spot %d, %d is transparent", c, size, hx, hy)
}
}
}
// The plus of zooming in crosses the lens, the minus of zooming out
// does not.
in, inXor, hx, hy := cursorMasks(platform.CursorZoomIn, 32)
out, outXor, _, _ := cursorMasks(platform.CursorZoomOut, 32)
above := (hy-3)*4 + hx/8
mask := byte(0x80 >> (hx % 8))
if in[above]&mask != 0 || inXor[above]&mask != 0 || out[above]&mask != 0 || outXor[above]&mask == 0 {
t.Error("the plus and the minus are not told apart above the lens's center")
}
}