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
@@ -0,0 +1,69 @@
|
||||
//go:build darwin
|
||||
|
||||
package text
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ebitengine/purego"
|
||||
)
|
||||
|
||||
// The leaves of rundelegate_darwin_*.s.
|
||||
func runDelegateDealloc()
|
||||
func runDelegateAscent()
|
||||
func runDelegateDescent()
|
||||
func runDelegateWidth()
|
||||
func runDelegateFuncs() (dealloc, ascent, descent, width uintptr)
|
||||
|
||||
// runDelegateCallbacks is a CTRunDelegateCallbacks, version 1.
|
||||
type runDelegateCallbacks struct {
|
||||
version int
|
||||
dealloc, ascent, descent, width uintptr
|
||||
}
|
||||
|
||||
// delegates makes Core Text's run delegates, which give inline objects
|
||||
// their size, from metrics the engine keeps, pinned, until it lays out the
|
||||
// next text.
|
||||
type delegates struct {
|
||||
create uintptr // CTRunDelegateCreate
|
||||
attribute uintptr // kCTRunDelegateAttributeName
|
||||
callbacks runDelegateCallbacks
|
||||
metrics [][3]float64
|
||||
pinner runtime.Pinner
|
||||
}
|
||||
|
||||
var runDelegates delegates
|
||||
|
||||
// initDelegates finds Core Text's run delegates in the framework text.
|
||||
func initDelegates(text uintptr, optional func(lib uintptr, name string) uintptr) {
|
||||
d := &runDelegates
|
||||
if sym, err := purego.Dlsym(text, "CTRunDelegateCreate"); err == nil {
|
||||
d.create = sym
|
||||
}
|
||||
d.attribute = optional(text, "kCTRunDelegateAttributeName")
|
||||
dealloc, ascent, descent, width := runDelegateFuncs()
|
||||
d.callbacks = runDelegateCallbacks{version: 1, dealloc: dealloc, ascent: ascent, descent: descent, width: width}
|
||||
}
|
||||
|
||||
// reset lets go of the metrics of the last text laid out, and makes room
|
||||
// for n objects.
|
||||
func (d *delegates) reset(n int) {
|
||||
d.pinner.Unpin()
|
||||
d.metrics = make([][3]float64, n)
|
||||
if n > 0 {
|
||||
d.pinner.Pin(&d.metrics[0])
|
||||
d.pinner.Pin(&d.callbacks)
|
||||
}
|
||||
}
|
||||
|
||||
// delegate returns a run delegate, owned, giving object k its height
|
||||
// above the baseline, its descent below it and its width.
|
||||
func (d *delegates) delegate(k int, width, height, descent float32) uintptr {
|
||||
if d.create == 0 || d.attribute == 0 || k >= len(d.metrics) {
|
||||
return 0
|
||||
}
|
||||
d.metrics[k] = [3]float64{float64(height), float64(descent), float64(width)}
|
||||
r, _, _ := purego.SyscallN(d.create, uintptr(unsafe.Pointer(&d.callbacks)), uintptr(unsafe.Pointer(&d.metrics[k])))
|
||||
return r
|
||||
}
|
||||
Reference in new issue
Block a user