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.
2289 lines
62 KiB
Swift
2289 lines
62 KiB
Swift
// Code generated by internal/mobile/wire/gen from spec.go; DO NOT EDIT.
|
|
|
|
// swiftlint:disable all
|
|
|
|
/// Writes the values of a message, as package wire encodes them.
|
|
public struct WireWriter {
|
|
public var buf: [UInt8] = []
|
|
public init() {}
|
|
mutating func uvarint(_ v: UInt64) {
|
|
var v = v
|
|
while v >= 0x80 { buf.append(UInt8(v & 0x7f) | 0x80); v >>= 7 }
|
|
buf.append(UInt8(v))
|
|
}
|
|
mutating func int(_ v: Int) { uvarint(UInt64(bitPattern: Int64((v << 1) ^ (v >> 63)))) }
|
|
mutating func bool(_ v: Bool) { buf.append(v ? 1 : 0) }
|
|
mutating func float(_ v: Double) { withUnsafeBytes(of: v.bitPattern.littleEndian) { buf.append(contentsOf: $0) } }
|
|
mutating func string(_ v: String) { let u = Array(v.utf8); uvarint(UInt64(u.count)); buf.append(contentsOf: u) }
|
|
mutating func bytes(_ v: [UInt8]) { uvarint(UInt64(v.count)); buf.append(contentsOf: v) }
|
|
mutating func strings(_ v: [String]) { uvarint(UInt64(v.count)); for s in v { string(s) } }
|
|
mutating func floats(_ v: [Double]) { uvarint(UInt64(v.count)); for f in v { float(f) } }
|
|
}
|
|
|
|
/// Reads the values of a message; past its end they read as zero.
|
|
public struct WireReader {
|
|
let buf: UnsafeRawBufferPointer
|
|
var at = 0
|
|
public init(_ buf: UnsafeRawBufferPointer) { self.buf = buf }
|
|
mutating func uvarint() -> UInt64 {
|
|
var v: UInt64 = 0, shift: UInt64 = 0
|
|
while at < buf.count {
|
|
let c = buf[at]; at += 1
|
|
v |= UInt64(c & 0x7f) << shift
|
|
if c < 0x80 { return v }
|
|
shift += 7
|
|
}
|
|
return 0
|
|
}
|
|
mutating func int() -> Int { let u = uvarint(); return Int(Int64(bitPattern: (u >> 1) ^ (0 &- (u & 1)))) }
|
|
mutating func bool() -> Bool { guard at < buf.count else { return false }; at += 1; return buf[at - 1] != 0 }
|
|
mutating func float() -> Double {
|
|
guard at + 8 <= buf.count else { at = buf.count; return 0 }
|
|
var bits: UInt64 = 0
|
|
for i in 0..<8 { bits |= UInt64(buf[at + i]) << (8 * UInt64(i)) }
|
|
at += 8
|
|
return Double(bitPattern: bits)
|
|
}
|
|
mutating func bytes() -> [UInt8] {
|
|
let n = Int(uvarint())
|
|
guard n >= 0, at + n <= buf.count else { at = buf.count; return [] }
|
|
defer { at += n }
|
|
return Array(buf[at..<at + n])
|
|
}
|
|
mutating func string() -> String { String(decoding: bytes(), as: UTF8.self) }
|
|
mutating func strings() -> [String] {
|
|
let n = Int(uvarint())
|
|
var s: [String] = []
|
|
for _ in 0..<min(n, buf.count - at) { s.append(string()) }
|
|
return s
|
|
}
|
|
mutating func floats() -> [Double] {
|
|
let n = Int(uvarint())
|
|
var f: [Double] = []
|
|
for _ in 0..<min(n, (buf.count - at) / 8) { f.append(float()) }
|
|
return f
|
|
}
|
|
}
|
|
|
|
public struct AppInfoReply {
|
|
public var name: String = ""
|
|
public var version: String = ""
|
|
public var identifier: String = ""
|
|
public var filesDir: String = ""
|
|
public var cacheDir: String = ""
|
|
public var tempDir: String = ""
|
|
public var documentsDir: String = ""
|
|
public var resourcesDir: String = ""
|
|
public var languages: [String] = []
|
|
public var regionLocale: String = ""
|
|
public var firstWeekday: Int = 0
|
|
public var hourCycle: Int = 0
|
|
public var system: String = ""
|
|
public var systemVersion: String = ""
|
|
public var model: String = ""
|
|
public var restoring: Bool = false
|
|
public var background: Bool = false
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(name)
|
|
w.string(version)
|
|
w.string(identifier)
|
|
w.string(filesDir)
|
|
w.string(cacheDir)
|
|
w.string(tempDir)
|
|
w.string(documentsDir)
|
|
w.string(resourcesDir)
|
|
w.strings(languages)
|
|
w.string(regionLocale)
|
|
w.int(firstWeekday)
|
|
w.int(hourCycle)
|
|
w.string(system)
|
|
w.string(systemVersion)
|
|
w.string(model)
|
|
w.bool(restoring)
|
|
w.bool(background)
|
|
}
|
|
}
|
|
|
|
public struct TimeZoneReply {
|
|
public var id: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(id)
|
|
}
|
|
}
|
|
|
|
public struct ThemeReply {
|
|
public var dark: Bool = false
|
|
public var accent: Int = 0
|
|
public var reduceMotion: Bool = false
|
|
public var reduceTransparency: Bool = false
|
|
public var increaseContrast: Bool = false
|
|
public var textScale: Double = 0
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.bool(dark)
|
|
w.int(accent)
|
|
w.bool(reduceMotion)
|
|
w.bool(reduceTransparency)
|
|
w.bool(increaseContrast)
|
|
w.float(textScale)
|
|
}
|
|
}
|
|
|
|
public struct SetAppearanceCall {
|
|
public var source: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
source = r.string()
|
|
}
|
|
}
|
|
|
|
public struct ScreenReply {
|
|
public var width: Double = 0
|
|
public var height: Double = 0
|
|
public var scale: Double = 0
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.float(width)
|
|
w.float(height)
|
|
w.float(scale)
|
|
}
|
|
}
|
|
|
|
public struct LogCall {
|
|
public var error: Bool = false
|
|
public var line: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
error = r.bool()
|
|
line = r.string()
|
|
}
|
|
}
|
|
|
|
public struct CreateWindowCall {
|
|
public var id: Int = 0
|
|
public var surface: Bool = false
|
|
public var ownScene: Bool = false
|
|
public var background: Int = 0
|
|
public var hasBackground: Bool = false
|
|
public var schemes: [String] = []
|
|
public var scripts: [String] = []
|
|
public var scriptFlags: [String] = []
|
|
public var userAgent: String = ""
|
|
public var userAgentSuffix: String = ""
|
|
public var inspectable: Bool = false
|
|
public var autoplay: Bool = false
|
|
public var swipeNavigation: Bool = false
|
|
public var pinchZoom: Bool = false
|
|
public var parent: Int = 0
|
|
public var viewType: String = ""
|
|
public var viewArgs: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
surface = r.bool()
|
|
ownScene = r.bool()
|
|
background = r.int()
|
|
hasBackground = r.bool()
|
|
schemes = r.strings()
|
|
scripts = r.strings()
|
|
scriptFlags = r.strings()
|
|
userAgent = r.string()
|
|
userAgentSuffix = r.string()
|
|
inspectable = r.bool()
|
|
autoplay = r.bool()
|
|
swipeNavigation = r.bool()
|
|
pinchZoom = r.bool()
|
|
parent = r.int()
|
|
viewType = r.string()
|
|
viewArgs = r.string()
|
|
}
|
|
}
|
|
|
|
public struct CreateWindowReply {
|
|
public var error: String = ""
|
|
public var layer: Int = 0
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(error)
|
|
w.int(layer)
|
|
}
|
|
}
|
|
|
|
public struct FirstFrameCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct PlaceViewsCall {
|
|
public var id: Int = 0
|
|
public var places: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
places = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct ShowWindowCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct HideWindowCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct CloseWindowCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SetBackgroundCall {
|
|
public var id: Int = 0
|
|
public var color: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
color = r.int()
|
|
}
|
|
}
|
|
|
|
public struct FocusCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SetTitleCall {
|
|
public var id: Int = 0
|
|
public var title: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
title = r.string()
|
|
}
|
|
}
|
|
|
|
public struct CreateTabsCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct AddTabCall {
|
|
public var id: Int = 0
|
|
public var window: Int = 0
|
|
public var title: String = ""
|
|
public var symbol: String = ""
|
|
public var icon: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
window = r.int()
|
|
title = r.string()
|
|
symbol = r.string()
|
|
icon = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct ShowTabsCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SelectTabCall {
|
|
public var id: Int = 0
|
|
public var index: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
index = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SetTabBadgeCall {
|
|
public var id: Int = 0
|
|
public var index: Int = 0
|
|
public var badge: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
index = r.int()
|
|
badge = r.string()
|
|
}
|
|
}
|
|
|
|
public struct CloseTabsCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct PushWindowCall {
|
|
public var parent: Int = 0
|
|
public var child: Int = 0
|
|
public var title: String = ""
|
|
public var animated: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
parent = r.int()
|
|
child = r.int()
|
|
title = r.string()
|
|
animated = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct PopWindowCall {
|
|
public var id: Int = 0
|
|
public var animated: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
animated = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct SetStackCall {
|
|
public var id: Int = 0
|
|
public var titles: [String] = []
|
|
public var keys: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
titles = r.strings()
|
|
keys = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct SetStackReply {
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
}
|
|
}
|
|
|
|
public struct StackShownCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct LoadURLCall {
|
|
public var id: Int = 0
|
|
public var url: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
url = r.string()
|
|
}
|
|
}
|
|
|
|
public struct LoadHTMLCall {
|
|
public var id: Int = 0
|
|
public var html: String = ""
|
|
public var baseURL: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
html = r.string()
|
|
baseURL = r.string()
|
|
}
|
|
}
|
|
|
|
public struct ReloadCall {
|
|
public var id: Int = 0
|
|
public var ignoreCache: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
ignoreCache = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct StopLoadingCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct GoBackCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct GoForwardCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct EvalCall {
|
|
public var id: Int = 0
|
|
public var js: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
js = r.string()
|
|
}
|
|
}
|
|
|
|
public struct CallAsyncCall {
|
|
public var id: Int = 0
|
|
public var req: Int = 0
|
|
public var body: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
req = r.int()
|
|
body = r.string()
|
|
}
|
|
}
|
|
|
|
public struct SetZoomCall {
|
|
public var id: Int = 0
|
|
public var factor: Double = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
factor = r.float()
|
|
}
|
|
}
|
|
|
|
public struct SetUserAgentCall {
|
|
public var id: Int = 0
|
|
public var userAgent: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
userAgent = r.string()
|
|
}
|
|
}
|
|
|
|
public struct SetUserScriptsCall {
|
|
public var id: Int = 0
|
|
public var scripts: [String] = []
|
|
public var scriptFlags: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
scripts = r.strings()
|
|
scriptFlags = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct CapturePageCall {
|
|
public var id: Int = 0
|
|
public var req: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
req = r.int()
|
|
}
|
|
}
|
|
|
|
public struct UserAgentCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct UserAgentReply {
|
|
public var userAgent: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(userAgent)
|
|
}
|
|
}
|
|
|
|
public struct SchemeRespondCall {
|
|
public var req: Int = 0
|
|
public var status: Int = 0
|
|
public var header: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
status = r.int()
|
|
header = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct SchemeDataCall {
|
|
public var req: Int = 0
|
|
public var data: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
data = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct SchemeFinishCall {
|
|
public var req: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SchemeFailCall {
|
|
public var req: Int = 0
|
|
public var message: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
message = r.string()
|
|
}
|
|
}
|
|
|
|
public struct MessageBoxCall {
|
|
public var req: Int = 0
|
|
public var type: String = ""
|
|
public var title: String = ""
|
|
public var message: String = ""
|
|
public var detail: String = ""
|
|
public var buttons: [String] = []
|
|
public var defaultID: Int = 0
|
|
public var cancelID: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
type = r.string()
|
|
title = r.string()
|
|
message = r.string()
|
|
detail = r.string()
|
|
buttons = r.strings()
|
|
defaultID = r.int()
|
|
cancelID = r.int()
|
|
}
|
|
}
|
|
|
|
public struct OpenFilesCall {
|
|
public var req: Int = 0
|
|
public var multiple: Bool = false
|
|
public var directories: Bool = false
|
|
public var extensions: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
multiple = r.bool()
|
|
directories = r.bool()
|
|
extensions = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct ShareFileCall {
|
|
public var path: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
path = r.string()
|
|
}
|
|
}
|
|
|
|
public struct ClipboardTextReply {
|
|
public var text: String = ""
|
|
public var ok: Bool = false
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(text)
|
|
w.bool(ok)
|
|
}
|
|
}
|
|
|
|
public struct SetClipboardTextCall {
|
|
public var text: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
text = r.string()
|
|
}
|
|
}
|
|
|
|
public struct OpenURLCall {
|
|
public var url: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
url = r.string()
|
|
}
|
|
}
|
|
|
|
public struct OpenURLReply {
|
|
public var ok: Bool = false
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.bool(ok)
|
|
}
|
|
}
|
|
|
|
public struct SecretGetCall {
|
|
public var service: String = ""
|
|
public var account: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
service = r.string()
|
|
account = r.string()
|
|
}
|
|
}
|
|
|
|
public struct SecretGetReply {
|
|
public var value: [UInt8] = []
|
|
public var found: Bool = false
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.bytes(value)
|
|
w.bool(found)
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
public struct SecretSetCall {
|
|
public var service: String = ""
|
|
public var account: String = ""
|
|
public var value: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
service = r.string()
|
|
account = r.string()
|
|
value = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct SecretSetReply {
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
public struct SecretDeleteCall {
|
|
public var service: String = ""
|
|
public var account: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
service = r.string()
|
|
account = r.string()
|
|
}
|
|
}
|
|
|
|
public struct SecretDeleteReply {
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
public struct NotifyCall {
|
|
public var req: Int = 0
|
|
public var notificationID: String = ""
|
|
public var title: String = ""
|
|
public var subtitle: String = ""
|
|
public var body: String = ""
|
|
public var group: String = ""
|
|
public var silent: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
notificationID = r.string()
|
|
title = r.string()
|
|
subtitle = r.string()
|
|
body = r.string()
|
|
group = r.string()
|
|
silent = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct RemoveNotificationCall {
|
|
public var notificationID: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
notificationID = r.string()
|
|
}
|
|
}
|
|
|
|
public struct KeepAwakeCall {
|
|
public var on: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
on = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct NetworkStatusReply {
|
|
public var online: Bool = false
|
|
public var metered: Bool = false
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.bool(online)
|
|
w.bool(metered)
|
|
}
|
|
}
|
|
|
|
public struct BatteryReply {
|
|
public var level: Double = 0
|
|
public var charging: Bool = false
|
|
public var lowPower: Bool = false
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.float(level)
|
|
w.bool(charging)
|
|
w.bool(lowPower)
|
|
}
|
|
}
|
|
|
|
public struct SetSystemBarsCall {
|
|
public var style: String = ""
|
|
public var hidden: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
style = r.string()
|
|
hidden = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct SetOrientationsCall {
|
|
public var mask: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
mask = r.int()
|
|
}
|
|
}
|
|
|
|
public struct ShareCall {
|
|
public var req: Int = 0
|
|
public var text: String = ""
|
|
public var url: String = ""
|
|
public var paths: [String] = []
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
text = r.string()
|
|
url = r.string()
|
|
paths = r.strings()
|
|
x = r.float()
|
|
y = r.float()
|
|
}
|
|
}
|
|
|
|
public struct SaveFileCall {
|
|
public var req: Int = 0
|
|
public var path: String = ""
|
|
public var name: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
path = r.string()
|
|
name = r.string()
|
|
}
|
|
}
|
|
|
|
public struct ClipboardImageReply {
|
|
public var png: [UInt8] = []
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.bytes(png)
|
|
}
|
|
}
|
|
|
|
public struct SetClipboardImageCall {
|
|
public var png: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
png = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct PopupMenuCall {
|
|
public var id: Int = 0
|
|
public var req: Int = 0
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public var items: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
req = r.int()
|
|
x = r.float()
|
|
y = r.float()
|
|
items = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct SetBarItemsCall {
|
|
public var id: Int = 0
|
|
public var titles: [String] = []
|
|
public var symbols: [String] = []
|
|
public var icons: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
titles = r.strings()
|
|
symbols = r.strings()
|
|
icons = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct PluginCallCall {
|
|
public var req: Int = 0
|
|
public var plugin: String = ""
|
|
public var method: String = ""
|
|
public var args: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
req = r.int()
|
|
plugin = r.string()
|
|
method = r.string()
|
|
args = r.string()
|
|
}
|
|
}
|
|
|
|
public struct AudioOpenCall {
|
|
public var rate: Int = 0
|
|
public var ahead: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
rate = r.int()
|
|
ahead = r.int()
|
|
}
|
|
}
|
|
|
|
public struct AudioOpenReply {
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
public struct AudioWriteCall {
|
|
public var samples: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
samples = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct AudioWriteReply {
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
public struct AudioCloseReply {
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
}
|
|
}
|
|
|
|
public struct HapticCall {
|
|
public var kind: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
kind = r.string()
|
|
}
|
|
}
|
|
|
|
public struct RequestFrameCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SetTextInputCall {
|
|
public var id: Int = 0
|
|
public var active: Bool = false
|
|
public var show: Int = 0
|
|
public var serial: Int = 0
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public var width: Double = 0
|
|
public var height: Double = 0
|
|
public var document: Bool = false
|
|
public var multiline: Bool = false
|
|
public var secure: Bool = false
|
|
public var keyboard: String = ""
|
|
public var returnKey: String = ""
|
|
public var capitalize: String = ""
|
|
public var autocorrect: String = ""
|
|
public var autofill: String = ""
|
|
public var text: String = ""
|
|
public var base: Int = 0
|
|
public var length: Int = 0
|
|
public var selStart: Int = 0
|
|
public var selEnd: Int = 0
|
|
public var markStart: Int = 0
|
|
public var markEnd: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
active = r.bool()
|
|
show = r.int()
|
|
serial = r.int()
|
|
x = r.float()
|
|
y = r.float()
|
|
width = r.float()
|
|
height = r.float()
|
|
document = r.bool()
|
|
multiline = r.bool()
|
|
secure = r.bool()
|
|
keyboard = r.string()
|
|
returnKey = r.string()
|
|
capitalize = r.string()
|
|
autocorrect = r.string()
|
|
autofill = r.string()
|
|
text = r.string()
|
|
base = r.int()
|
|
length = r.int()
|
|
selStart = r.int()
|
|
selEnd = r.int()
|
|
markStart = r.int()
|
|
markEnd = r.int()
|
|
}
|
|
}
|
|
|
|
public struct SetCursorCall {
|
|
public var id: Int = 0
|
|
public var cursor: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
cursor = r.string()
|
|
}
|
|
}
|
|
|
|
public struct AccessibilityChangedCall {
|
|
public var id: Int = 0
|
|
public var focus: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
focus = r.int()
|
|
}
|
|
}
|
|
|
|
public struct AnnounceCall {
|
|
public var text: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
text = r.string()
|
|
}
|
|
}
|
|
|
|
public struct ShowMenuCall {
|
|
public var id: Int = 0
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public var actions: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
x = r.float()
|
|
y = r.float()
|
|
actions = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct SetBackAvailableCall {
|
|
public var id: Int = 0
|
|
public var on: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
on = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct ShowMagnifierCall {
|
|
public var id: Int = 0
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
x = r.float()
|
|
y = r.float()
|
|
}
|
|
}
|
|
|
|
public struct HideMagnifierCall {
|
|
public var id: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
id = r.int()
|
|
}
|
|
}
|
|
|
|
public struct TextMetricsCall {
|
|
public var family: String = ""
|
|
public var size: Double = 0
|
|
public var weight: Int = 0
|
|
public var italic: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
family = r.string()
|
|
size = r.float()
|
|
weight = r.int()
|
|
italic = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct TextMetricsReply {
|
|
public var ascent: Double = 0
|
|
public var descent: Double = 0
|
|
public var xHeight: Double = 0
|
|
public var underlinePosition: Double = 0
|
|
public var underlineThickness: Double = 0
|
|
public var strikePosition: Double = 0
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.float(ascent)
|
|
w.float(descent)
|
|
w.float(xHeight)
|
|
w.float(underlinePosition)
|
|
w.float(underlineThickness)
|
|
w.float(strikePosition)
|
|
}
|
|
}
|
|
|
|
public struct MeasureTextCall {
|
|
public var family: String = ""
|
|
public var size: Double = 0
|
|
public var weight: Int = 0
|
|
public var italic: Bool = false
|
|
public var noKern: Bool = false
|
|
public var texts: [String] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
family = r.string()
|
|
size = r.float()
|
|
weight = r.int()
|
|
italic = r.bool()
|
|
noKern = r.bool()
|
|
texts = r.strings()
|
|
}
|
|
}
|
|
|
|
public struct MeasureTextReply {
|
|
public var widths: [Double] = []
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.floats(widths)
|
|
}
|
|
}
|
|
|
|
public struct TextAdvancesCall {
|
|
public var family: String = ""
|
|
public var size: Double = 0
|
|
public var weight: Int = 0
|
|
public var italic: Bool = false
|
|
public var noKern: Bool = false
|
|
public var text: String = ""
|
|
public var rtl: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
family = r.string()
|
|
size = r.float()
|
|
weight = r.int()
|
|
italic = r.bool()
|
|
noKern = r.bool()
|
|
text = r.string()
|
|
rtl = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct TextAdvancesReply {
|
|
public var advances: [Double] = []
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.floats(advances)
|
|
}
|
|
}
|
|
|
|
public struct DrawTextCall {
|
|
public var family: String = ""
|
|
public var size: Double = 0
|
|
public var weight: Int = 0
|
|
public var italic: Bool = false
|
|
public var text: String = ""
|
|
public var scale: Double = 0
|
|
public var dx: Double = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
family = r.string()
|
|
size = r.float()
|
|
weight = r.int()
|
|
italic = r.bool()
|
|
text = r.string()
|
|
scale = r.float()
|
|
dx = r.float()
|
|
}
|
|
}
|
|
|
|
public struct DrawTextReply {
|
|
public var left: Int = 0
|
|
public var top: Int = 0
|
|
public var width: Int = 0
|
|
public var height: Int = 0
|
|
public var color: Bool = false
|
|
public var pixels: [UInt8] = []
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.int(left)
|
|
w.int(top)
|
|
w.int(width)
|
|
w.int(height)
|
|
w.bool(color)
|
|
w.bytes(pixels)
|
|
}
|
|
}
|
|
|
|
public struct RegisterFontCall {
|
|
public var data: [UInt8] = []
|
|
public var family: String = ""
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
data = r.bytes()
|
|
family = r.string()
|
|
}
|
|
}
|
|
|
|
public struct RegisterFontReply {
|
|
public var family: String = ""
|
|
public var error: String = ""
|
|
public init() {}
|
|
func encode(_ w: inout WireWriter) {
|
|
w.string(family)
|
|
w.string(error)
|
|
}
|
|
}
|
|
|
|
/// The calls Go makes of the host, on the main thread.
|
|
public protocol HostCalls: AnyObject {
|
|
/// the app's bundle and the system's settings, asked once at start
|
|
func appInfo() -> AppInfoReply
|
|
/// the name of the system's time zone; any thread
|
|
func timeZone() -> TimeZoneReply
|
|
/// the appearance and the accessibility preferences
|
|
func theme() -> ThemeReply
|
|
/// the appearance the app asks for: "light", "dark" or "system"
|
|
func setAppearance(_ c: SetAppearanceCall)
|
|
/// the screen's size in DIPs and scale
|
|
func screen() -> ScreenReply
|
|
/// a line the app wrote to its standard output or error
|
|
func log(_ c: LogCall)
|
|
/// the screen's content: a web view, or a surface for native UI
|
|
func createWindow(_ c: CreateWindowCall) -> CreateWindowReply
|
|
/// the window's content presented its first frame
|
|
func firstFrame(_ c: FirstFrameCall)
|
|
/// where a surface shows the windows it holds (Parent), under it, in the order painted; the others hide. Places: encoded by Go (encodePlaces)
|
|
func placeViews(_ c: PlaceViewsCall)
|
|
func showWindow(_ c: ShowWindowCall)
|
|
func hideWindow(_ c: HideWindowCall)
|
|
func closeWindow(_ c: CloseWindowCall)
|
|
func setBackground(_ c: SetBackgroundCall)
|
|
func focus(_ c: FocusCall)
|
|
/// the window's title, which a navigation bar shows
|
|
func setTitle(_ c: SetTitleCall)
|
|
/// a bar of tabs, whose tabs AddTab adds before ShowTabs shows it
|
|
func createTabs(_ c: CreateTabsCall)
|
|
func addTab(_ c: AddTabCall)
|
|
func showTabs(_ c: ShowTabsCall)
|
|
func selectTab(_ c: SelectTabCall)
|
|
func setTabBadge(_ c: SetTabBadgeCall)
|
|
func closeTabs(_ c: CloseTabsCall)
|
|
/// shows Child over Parent in Parent's stack, under a bar with its Title and a back button
|
|
func pushWindow(_ c: PushWindowCall)
|
|
func popWindow(_ c: PopWindowCall)
|
|
/// a router's pages as the window's stack of screens, its first page and those deeper (Titles, told apart by Keys): the screens of the keys the stack shows stay, the others are pushed, popped or replaced; none take the stack away. Answered once the screen going out of sight holds what the surface shows, as the surface is about to show the page coming
|
|
func setStack(_ c: SetStackCall) -> SetStackReply
|
|
/// the surface shows the page of the stack's last screen, after SetStack or StackPopped
|
|
func stackShown(_ c: StackShownCall)
|
|
func loadURL(_ c: LoadURLCall)
|
|
func loadHTML(_ c: LoadHTMLCall)
|
|
func reload(_ c: ReloadCall)
|
|
func stopLoading(_ c: StopLoadingCall)
|
|
func goBack(_ c: GoBackCall)
|
|
func goForward(_ c: GoForwardCall)
|
|
func eval(_ c: EvalCall)
|
|
/// runs Body as an async function's; AsyncResult answers
|
|
func callAsync(_ c: CallAsyncCall)
|
|
func setZoom(_ c: SetZoomCall)
|
|
func setUserAgent(_ c: SetUserAgentCall)
|
|
func setUserScripts(_ c: SetUserScriptsCall)
|
|
/// a PNG of the page; Captured answers
|
|
func capturePage(_ c: CapturePageCall)
|
|
func userAgent(_ c: UserAgentCall) -> UserAgentReply
|
|
/// the status and headers of a SchemeRequest (Header: names and values in turn)
|
|
func schemeRespond(_ c: SchemeRespondCall)
|
|
func schemeData(_ c: SchemeDataCall)
|
|
func schemeFinish(_ c: SchemeFinishCall)
|
|
func schemeFail(_ c: SchemeFailCall)
|
|
/// an alert; MessageBoxResult answers
|
|
func messageBox(_ c: MessageBoxCall)
|
|
/// the system's picker of documents; FilesResult answers with copies the app may read
|
|
func openFiles(_ c: OpenFilesCall)
|
|
/// the share sheet of a file, as the place to save it
|
|
func shareFile(_ c: ShareFileCall)
|
|
func clipboardText() -> ClipboardTextReply
|
|
func setClipboardText(_ c: SetClipboardTextCall)
|
|
/// opens a URL in the app the system has for it
|
|
func openURL(_ c: OpenURLCall) -> OpenURLReply
|
|
func secretGet(_ c: SecretGetCall) -> SecretGetReply
|
|
func secretSet(_ c: SecretSetCall) -> SecretSetReply
|
|
func secretDelete(_ c: SecretDeleteCall) -> SecretDeleteReply
|
|
/// a local notification; NotifyDone answers once the system has it
|
|
func notify(_ c: NotifyCall)
|
|
func removeNotification(_ c: RemoveNotificationCall)
|
|
func removeAllNotifications()
|
|
/// keeps the screen on while the app shows
|
|
func keepAwake(_ c: KeepAwakeCall)
|
|
func networkStatus() -> NetworkStatusReply
|
|
/// starts NetworkChanged
|
|
func watchNetwork()
|
|
func battery() -> BatteryReply
|
|
/// the icons of the system's bars ("auto", "light" or "dark"), and whether the bars hide
|
|
func setSystemBars(_ c: SetSystemBarsCall)
|
|
/// the orientations the screen may take: 1 portrait, 2 upside down, 4 landscape left, 8 landscape right; 0 any
|
|
func setOrientations(_ c: SetOrientationsCall)
|
|
/// the share sheet of text, a link and files; ShareResult answers
|
|
func share(_ c: ShareCall)
|
|
/// the system's picker of where to keep a copy of Path under Name; FilesResult answers with the place, empty when dismissed
|
|
func saveFile(_ c: SaveFileCall)
|
|
func clipboardImage() -> ClipboardImageReply
|
|
func setClipboardImage(_ c: SetClipboardImageCall)
|
|
/// the system's menu at a point of the window: Items are encoded by Go (encodeMenu); MenuPicked answers with the item's ID, 0 when dismissed
|
|
func popupMenu(_ c: PopupMenuCall)
|
|
/// the buttons at the end of the window's navigation bar; BarItemClicked tells which: titles, symbols and icons by index
|
|
func setBarItems(_ c: SetBarItemsCall)
|
|
/// a call of a plugin's native code: Args and PluginResult's Result are JSON
|
|
func pluginCall(_ c: PluginCallCall)
|
|
/// opens the sound's output: stereo at Rate frames a second, holding about Ahead milliseconds; on the caller's thread
|
|
func audioOpen(_ c: AudioOpenCall) -> AudioOpenReply
|
|
/// plays interleaved stereo float32 samples after those written, waiting while the output holds enough; on the caller's thread
|
|
func audioWrite(_ c: AudioWriteCall) -> AudioWriteReply
|
|
func audioClose() -> AudioCloseReply
|
|
/// "selection", "light", "medium", "heavy", "success", "warning" or "error"
|
|
func haptic(_ c: HapticCall)
|
|
/// asks for a Frame at the next refresh of the display
|
|
func requestFrame(_ c: RequestFrameCall)
|
|
/// whether the keyboard shows and what for: the input's traits (platform.TextTraits), and its text. Show counts the requests to show the keyboard again. Offsets are UTF-16 units of the document, of which Text is the part around the selection, from Base; MarkStart is -1 without marked text. A window without Document takes text without one, as a terminal: the keyboard sees none
|
|
func setTextInput(_ c: SetTextInputCall)
|
|
/// the pointer's shape, for a mouse or a trackpad
|
|
func setCursor(_ c: SetCursorCall)
|
|
/// the tree of accessible elements changed; Focus names the one with the focus
|
|
func accessibilityChanged(_ c: AccessibilityChangedCall)
|
|
func announce(_ c: AnnounceCall)
|
|
/// the system's edit menu at a point, with the actions given (cut, copy, paste, selectAll); TextCommand answers
|
|
func showMenu(_ c: ShowMenuCall)
|
|
/// whether the content takes the system's back
|
|
func setBackAvailable(_ c: SetBackAvailableCall)
|
|
/// the system's magnifier of what is at a point
|
|
func showMagnifier(_ c: ShowMagnifierCall)
|
|
func hideMagnifier(_ c: HideMagnifierCall)
|
|
/// the metrics of a font (Android's Paint): ascent and descent, x-height, underline and strikethrough
|
|
func textMetrics(_ c: TextMetricsCall) -> TextMetricsReply
|
|
/// how wide each of Texts is in a font, kerned unless NoKern
|
|
func measureText(_ c: MeasureTextCall) -> MeasureTextReply
|
|
/// the advance of each UTF-16 unit of Text laid out as a whole (getTextRunAdvances)
|
|
func textAdvances(_ c: TextAdvancesCall) -> TextAdvancesReply
|
|
/// draws Text in white at Scale pixels per DIP, its pen DX pixels right of a pixel's edge: its ink's box from the pen and its pixels, a byte of coverage each, or premultiplied RGBA when Color
|
|
func drawText(_ c: DrawTextCall) -> DrawTextReply
|
|
/// adds a font file under Family, or its own family when empty
|
|
func registerFont(_ c: RegisterFontCall) -> RegisterFontReply
|
|
}
|
|
|
|
/// Runs a call on h and encodes its reply, nil for a call not waited for.
|
|
public func dispatchCall(_ h: HostCalls, _ buf: UnsafeRawBufferPointer) -> [UInt8]? {
|
|
var r = WireReader(buf)
|
|
var w = WireWriter()
|
|
switch r.uvarint() {
|
|
case 1:
|
|
h.appInfo().encode(&w)
|
|
return w.buf
|
|
case 2:
|
|
h.timeZone().encode(&w)
|
|
return w.buf
|
|
case 3:
|
|
h.theme().encode(&w)
|
|
return w.buf
|
|
case 4:
|
|
h.setAppearance(SetAppearanceCall(&r))
|
|
return nil
|
|
case 5:
|
|
h.screen().encode(&w)
|
|
return w.buf
|
|
case 6:
|
|
h.log(LogCall(&r))
|
|
return nil
|
|
case 7:
|
|
h.createWindow(CreateWindowCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 8:
|
|
h.firstFrame(FirstFrameCall(&r))
|
|
return nil
|
|
case 9:
|
|
h.placeViews(PlaceViewsCall(&r))
|
|
return nil
|
|
case 10:
|
|
h.showWindow(ShowWindowCall(&r))
|
|
return nil
|
|
case 11:
|
|
h.hideWindow(HideWindowCall(&r))
|
|
return nil
|
|
case 12:
|
|
h.closeWindow(CloseWindowCall(&r))
|
|
return nil
|
|
case 13:
|
|
h.setBackground(SetBackgroundCall(&r))
|
|
return nil
|
|
case 14:
|
|
h.focus(FocusCall(&r))
|
|
return nil
|
|
case 15:
|
|
h.setTitle(SetTitleCall(&r))
|
|
return nil
|
|
case 16:
|
|
h.createTabs(CreateTabsCall(&r))
|
|
return nil
|
|
case 17:
|
|
h.addTab(AddTabCall(&r))
|
|
return nil
|
|
case 18:
|
|
h.showTabs(ShowTabsCall(&r))
|
|
return nil
|
|
case 19:
|
|
h.selectTab(SelectTabCall(&r))
|
|
return nil
|
|
case 20:
|
|
h.setTabBadge(SetTabBadgeCall(&r))
|
|
return nil
|
|
case 21:
|
|
h.closeTabs(CloseTabsCall(&r))
|
|
return nil
|
|
case 22:
|
|
h.pushWindow(PushWindowCall(&r))
|
|
return nil
|
|
case 23:
|
|
h.popWindow(PopWindowCall(&r))
|
|
return nil
|
|
case 24:
|
|
h.setStack(SetStackCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 25:
|
|
h.stackShown(StackShownCall(&r))
|
|
return nil
|
|
case 26:
|
|
h.loadURL(LoadURLCall(&r))
|
|
return nil
|
|
case 27:
|
|
h.loadHTML(LoadHTMLCall(&r))
|
|
return nil
|
|
case 28:
|
|
h.reload(ReloadCall(&r))
|
|
return nil
|
|
case 29:
|
|
h.stopLoading(StopLoadingCall(&r))
|
|
return nil
|
|
case 30:
|
|
h.goBack(GoBackCall(&r))
|
|
return nil
|
|
case 31:
|
|
h.goForward(GoForwardCall(&r))
|
|
return nil
|
|
case 32:
|
|
h.eval(EvalCall(&r))
|
|
return nil
|
|
case 33:
|
|
h.callAsync(CallAsyncCall(&r))
|
|
return nil
|
|
case 34:
|
|
h.setZoom(SetZoomCall(&r))
|
|
return nil
|
|
case 35:
|
|
h.setUserAgent(SetUserAgentCall(&r))
|
|
return nil
|
|
case 36:
|
|
h.setUserScripts(SetUserScriptsCall(&r))
|
|
return nil
|
|
case 37:
|
|
h.capturePage(CapturePageCall(&r))
|
|
return nil
|
|
case 38:
|
|
h.userAgent(UserAgentCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 39:
|
|
h.schemeRespond(SchemeRespondCall(&r))
|
|
return nil
|
|
case 40:
|
|
h.schemeData(SchemeDataCall(&r))
|
|
return nil
|
|
case 41:
|
|
h.schemeFinish(SchemeFinishCall(&r))
|
|
return nil
|
|
case 42:
|
|
h.schemeFail(SchemeFailCall(&r))
|
|
return nil
|
|
case 43:
|
|
h.messageBox(MessageBoxCall(&r))
|
|
return nil
|
|
case 44:
|
|
h.openFiles(OpenFilesCall(&r))
|
|
return nil
|
|
case 45:
|
|
h.shareFile(ShareFileCall(&r))
|
|
return nil
|
|
case 46:
|
|
h.clipboardText().encode(&w)
|
|
return w.buf
|
|
case 47:
|
|
h.setClipboardText(SetClipboardTextCall(&r))
|
|
return nil
|
|
case 48:
|
|
h.openURL(OpenURLCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 49:
|
|
h.secretGet(SecretGetCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 50:
|
|
h.secretSet(SecretSetCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 51:
|
|
h.secretDelete(SecretDeleteCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 52:
|
|
h.notify(NotifyCall(&r))
|
|
return nil
|
|
case 53:
|
|
h.removeNotification(RemoveNotificationCall(&r))
|
|
return nil
|
|
case 54:
|
|
h.removeAllNotifications()
|
|
return nil
|
|
case 55:
|
|
h.keepAwake(KeepAwakeCall(&r))
|
|
return nil
|
|
case 56:
|
|
h.networkStatus().encode(&w)
|
|
return w.buf
|
|
case 57:
|
|
h.watchNetwork()
|
|
return nil
|
|
case 58:
|
|
h.battery().encode(&w)
|
|
return w.buf
|
|
case 59:
|
|
h.setSystemBars(SetSystemBarsCall(&r))
|
|
return nil
|
|
case 60:
|
|
h.setOrientations(SetOrientationsCall(&r))
|
|
return nil
|
|
case 61:
|
|
h.share(ShareCall(&r))
|
|
return nil
|
|
case 62:
|
|
h.saveFile(SaveFileCall(&r))
|
|
return nil
|
|
case 63:
|
|
h.clipboardImage().encode(&w)
|
|
return w.buf
|
|
case 64:
|
|
h.setClipboardImage(SetClipboardImageCall(&r))
|
|
return nil
|
|
case 65:
|
|
h.popupMenu(PopupMenuCall(&r))
|
|
return nil
|
|
case 66:
|
|
h.setBarItems(SetBarItemsCall(&r))
|
|
return nil
|
|
case 67:
|
|
h.pluginCall(PluginCallCall(&r))
|
|
return nil
|
|
case 68:
|
|
h.audioOpen(AudioOpenCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 69:
|
|
h.audioWrite(AudioWriteCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 70:
|
|
h.audioClose().encode(&w)
|
|
return w.buf
|
|
case 71:
|
|
h.haptic(HapticCall(&r))
|
|
return nil
|
|
case 72:
|
|
h.requestFrame(RequestFrameCall(&r))
|
|
return nil
|
|
case 73:
|
|
h.setTextInput(SetTextInputCall(&r))
|
|
return nil
|
|
case 74:
|
|
h.setCursor(SetCursorCall(&r))
|
|
return nil
|
|
case 75:
|
|
h.accessibilityChanged(AccessibilityChangedCall(&r))
|
|
return nil
|
|
case 76:
|
|
h.announce(AnnounceCall(&r))
|
|
return nil
|
|
case 77:
|
|
h.showMenu(ShowMenuCall(&r))
|
|
return nil
|
|
case 78:
|
|
h.setBackAvailable(SetBackAvailableCall(&r))
|
|
return nil
|
|
case 79:
|
|
h.showMagnifier(ShowMagnifierCall(&r))
|
|
return nil
|
|
case 80:
|
|
h.hideMagnifier(HideMagnifierCall(&r))
|
|
return nil
|
|
case 81:
|
|
h.textMetrics(TextMetricsCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 82:
|
|
h.measureText(MeasureTextCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 83:
|
|
h.textAdvances(TextAdvancesCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 84:
|
|
h.drawText(DrawTextCall(&r)).encode(&w)
|
|
return w.buf
|
|
case 85:
|
|
h.registerFont(RegisterFontCall(&r)).encode(&w)
|
|
return w.buf
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
/// Encodes the events the host sends Go.
|
|
public enum Event {
|
|
/// the app finished launching
|
|
public static func ready() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(1)
|
|
return w.buf
|
|
}
|
|
/// the app is in front, or no longer
|
|
public static func active(active: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(2)
|
|
w.bool(active)
|
|
return w.buf
|
|
}
|
|
/// the app goes to the background (true) or came back. The host waits: iOS ends apps that use the GPU in the background, so that frames stop before it returns
|
|
public static func background(background: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(3)
|
|
w.bool(background)
|
|
return w.buf
|
|
}
|
|
public static func themeChanged() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(4)
|
|
return w.buf
|
|
}
|
|
public static func localeChanged() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(5)
|
|
return w.buf
|
|
}
|
|
public static func timeZoneChanged(id: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(6)
|
|
w.string(id)
|
|
return w.buf
|
|
}
|
|
public static func openURLs(urls: [String]) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(7)
|
|
w.strings(urls)
|
|
return w.buf
|
|
}
|
|
public static func memoryWarning() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(8)
|
|
return w.buf
|
|
}
|
|
/// the process ends once Go answers
|
|
public static func terminating() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(9)
|
|
return w.buf
|
|
}
|
|
/// the window's size in DIPs, the scale, and the insets of what covers it: the system's bars, the cutout, the keyboard
|
|
public static func resized(id: Int, width: Double, height: Double, scale: Double, safeTop: Double, safeLeft: Double, safeBottom: Double, safeRight: Double, keyboard: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(10)
|
|
w.int(id)
|
|
w.float(width)
|
|
w.float(height)
|
|
w.float(scale)
|
|
w.float(safeTop)
|
|
w.float(safeLeft)
|
|
w.float(safeBottom)
|
|
w.float(safeRight)
|
|
w.float(keyboard)
|
|
return w.buf
|
|
}
|
|
/// the system's gesture of going back, as it goes: Phase is "started", "progress" or "cancelled"
|
|
public static func backGesture(id: Int, phase: String, progress: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(11)
|
|
w.int(id)
|
|
w.string(phase)
|
|
w.float(progress)
|
|
return w.buf
|
|
}
|
|
/// a tap on iOS's status bar
|
|
public static func statusBarTapped() -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(12)
|
|
return w.buf
|
|
}
|
|
/// a finger went down on a view a surface holds, which takes it
|
|
public static func viewPressed(id: Int, x: Double, y: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(13)
|
|
w.int(id)
|
|
w.float(x)
|
|
w.float(y)
|
|
return w.buf
|
|
}
|
|
public static func pluginResult(req: Int, result: String, error: String, code: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(14)
|
|
w.int(req)
|
|
w.string(result)
|
|
w.string(error)
|
|
w.string(code)
|
|
return w.buf
|
|
}
|
|
/// an event of a plugin's native code: Data is JSON
|
|
public static func pluginEvent(plugin: String, name: String, data: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(15)
|
|
w.string(plugin)
|
|
w.string(name)
|
|
w.string(data)
|
|
return w.buf
|
|
}
|
|
public static func networkChanged(online: Bool, metered: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(16)
|
|
w.bool(online)
|
|
w.bool(metered)
|
|
return w.buf
|
|
}
|
|
public static func shareResult(req: Int, error: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(17)
|
|
w.int(req)
|
|
w.string(error)
|
|
return w.buf
|
|
}
|
|
public static func menuPicked(req: Int, item: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(18)
|
|
w.int(req)
|
|
w.int(item)
|
|
return w.buf
|
|
}
|
|
public static func barItemClicked(id: Int, index: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(19)
|
|
w.int(id)
|
|
w.int(index)
|
|
return w.buf
|
|
}
|
|
/// the user chose tab Index
|
|
public static func tabSelected(id: Int, index: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(20)
|
|
w.int(id)
|
|
w.int(index)
|
|
return w.buf
|
|
}
|
|
/// the user took screens off a window's stack (SetStack): Depth stay
|
|
public static func stackPopped(id: Int, depth: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(21)
|
|
w.int(id)
|
|
w.int(depth)
|
|
return w.buf
|
|
}
|
|
/// the window left its stack: the back button, a swipe, Android's back, or PopWindow
|
|
public static func popped(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(22)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// Android's back: whether the app took it
|
|
public static func backPressed(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(23)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// a message the page's bridge posted
|
|
public static func message(id: Int, text: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(24)
|
|
w.int(id)
|
|
w.string(text)
|
|
return w.buf
|
|
}
|
|
public static func willNavigate(id: Int, url: String, mainFrame: Bool, userInitiated: Bool, unasked: Bool, reload: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(25)
|
|
w.int(id)
|
|
w.string(url)
|
|
w.bool(mainFrame)
|
|
w.bool(userInitiated)
|
|
w.bool(unasked)
|
|
w.bool(reload)
|
|
return w.buf
|
|
}
|
|
/// window.open or a link to _blank: whether the app opened it
|
|
public static func newWindow(id: Int, url: String, userInitiated: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(26)
|
|
w.int(id)
|
|
w.string(url)
|
|
w.bool(userInitiated)
|
|
return w.buf
|
|
}
|
|
/// what the page is at, after any change of it
|
|
public static func pageState(id: Int, url: String, title: String, loading: Bool, canGoBack: Bool, canGoForward: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(27)
|
|
w.int(id)
|
|
w.string(url)
|
|
w.string(title)
|
|
w.bool(loading)
|
|
w.bool(canGoBack)
|
|
w.bool(canGoForward)
|
|
return w.buf
|
|
}
|
|
public static func navigationStarted(id: Int, url: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(28)
|
|
w.int(id)
|
|
w.string(url)
|
|
return w.buf
|
|
}
|
|
public static func navigationCommitted(id: Int, url: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(29)
|
|
w.int(id)
|
|
w.string(url)
|
|
return w.buf
|
|
}
|
|
public static func loadFinished(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(30)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
public static func loadFailed(id: Int, url: String, code: Int, description: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(31)
|
|
w.int(id)
|
|
w.string(url)
|
|
w.int(code)
|
|
w.string(description)
|
|
return w.buf
|
|
}
|
|
public static func closedByPage(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(32)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// the user went to a window of its own scene, or (0) to the app's first
|
|
public static func windowFront(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(33)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
public static func processGone(id: Int, reason: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(34)
|
|
w.int(id)
|
|
w.string(reason)
|
|
return w.buf
|
|
}
|
|
public static func permissionRequested(id: Int, kinds: [String], origin: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(35)
|
|
w.int(id)
|
|
w.strings(kinds)
|
|
w.string(origin)
|
|
return w.buf
|
|
}
|
|
/// a request of one of the app's schemes (Header: names and values in turn)
|
|
public static func schemeRequest(id: Int, req: Int, method: String, url: String, header: [String], body: [UInt8], hasBody: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(36)
|
|
w.int(id)
|
|
w.int(req)
|
|
w.string(method)
|
|
w.string(url)
|
|
w.strings(header)
|
|
w.bytes(body)
|
|
w.bool(hasBody)
|
|
return w.buf
|
|
}
|
|
public static func schemeCancel(req: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(37)
|
|
w.int(req)
|
|
return w.buf
|
|
}
|
|
public static func asyncResult(req: Int, result: String, error: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(38)
|
|
w.int(req)
|
|
w.string(result)
|
|
w.string(error)
|
|
return w.buf
|
|
}
|
|
public static func captured(req: Int, png: [UInt8], error: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(39)
|
|
w.int(req)
|
|
w.bytes(png)
|
|
w.string(error)
|
|
return w.buf
|
|
}
|
|
public static func messageBoxResult(req: Int, response: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(40)
|
|
w.int(req)
|
|
w.int(response)
|
|
return w.buf
|
|
}
|
|
public static func filesResult(req: Int, paths: [String], error: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(41)
|
|
w.int(req)
|
|
w.strings(paths)
|
|
w.string(error)
|
|
return w.buf
|
|
}
|
|
public static func notifyDone(req: Int, error: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(42)
|
|
w.int(req)
|
|
w.string(error)
|
|
return w.buf
|
|
}
|
|
public static func notificationClicked(notificationID: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(43)
|
|
w.string(notificationID)
|
|
return w.buf
|
|
}
|
|
/// the display refreshes: draw a frame if one was asked for
|
|
public static func frame(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(44)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// the native surface to draw on (a CAMetalLayer, an ANativeWindow), 0 when gone
|
|
public static func surfaceChanged(id: Int, handle: Int, width: Double, height: Double, scale: Double, refresh: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(45)
|
|
w.int(id)
|
|
w.int(handle)
|
|
w.float(width)
|
|
w.float(height)
|
|
w.float(scale)
|
|
w.float(refresh)
|
|
return w.buf
|
|
}
|
|
/// the native surface goes: the host waits for Go to let go of it
|
|
public static func surfaceDestroyed(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(46)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// a finger, a pen or a mouse: Phase is "down", "move", "up" or "cancel", Kind "touch", "pen" or "mouse"
|
|
public static func touch(id: Int, pointer: Int, phase: String, kind: String, x: Double, y: Double, pressure: Double, buttons: Int, time: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(47)
|
|
w.int(id)
|
|
w.int(pointer)
|
|
w.string(phase)
|
|
w.string(kind)
|
|
w.float(x)
|
|
w.float(y)
|
|
w.float(pressure)
|
|
w.int(buttons)
|
|
w.float(time)
|
|
return w.buf
|
|
}
|
|
/// a mouse's or a trackpad's scrolling, in DIPs
|
|
public static func scroll(id: Int, x: Double, y: Double, dx: Double, dy: Double, precise: Bool, phase: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(48)
|
|
w.int(id)
|
|
w.float(x)
|
|
w.float(y)
|
|
w.float(dx)
|
|
w.float(dy)
|
|
w.bool(precise)
|
|
w.string(phase)
|
|
return w.buf
|
|
}
|
|
/// a hardware keyboard's key: Down, its name (as ui names keys) and the text it types
|
|
public static func key(id: Int, down: Bool, key: String, text: String, mods: Int, repeated: Bool) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(49)
|
|
w.int(id)
|
|
w.bool(down)
|
|
w.string(key)
|
|
w.string(text)
|
|
w.int(mods)
|
|
w.bool(repeated)
|
|
return w.buf
|
|
}
|
|
/// the keyboard put Text in Start to End of the document, or with no range in place of the marked text or the selection; answers TextStateReply
|
|
public static func textReplace(id: Int, hasRange: Bool, start: Int, end: Int, text: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(50)
|
|
w.int(id)
|
|
w.bool(hasRange)
|
|
w.int(start)
|
|
w.int(end)
|
|
w.string(text)
|
|
return w.buf
|
|
}
|
|
/// the input method composes Text over Start to End, or with no range over the marked text or the selection; SelStart and SelEnd are in Text; answers TextStateReply
|
|
public static func textMark(id: Int, hasRange: Bool, start: Int, end: Int, text: String, selStart: Int, selEnd: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(51)
|
|
w.int(id)
|
|
w.bool(hasRange)
|
|
w.int(start)
|
|
w.int(end)
|
|
w.string(text)
|
|
w.int(selStart)
|
|
w.int(selEnd)
|
|
return w.buf
|
|
}
|
|
/// the marked text stays as text; answers TextStateReply
|
|
public static func textUnmark(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(52)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// the keyboard deleted Before units before the selection and After after it; answers TextStateReply
|
|
public static func textDelete(id: Int, before: Int, after: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(53)
|
|
w.int(id)
|
|
w.int(before)
|
|
w.int(after)
|
|
return w.buf
|
|
}
|
|
/// the keyboard moved the selection; answers TextStateReply
|
|
public static func textSelect(id: Int, start: Int, end: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(54)
|
|
w.int(id)
|
|
w.int(start)
|
|
w.int(end)
|
|
return w.buf
|
|
}
|
|
/// an editing action of the keyboard or the edit menu: "newline", "tab", "deleteBackward", "deleteForward", "cut", "copy", "paste", "selectAll", "left", …; answers TextStateReply
|
|
public static func textCommand(id: Int, command: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(55)
|
|
w.int(id)
|
|
w.string(command)
|
|
return w.buf
|
|
}
|
|
/// the text around the selection, and the selection
|
|
public static func textState(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(56)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// a part of the document outside the text the host has
|
|
public static func textRange(id: Int, start: Int, end: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(57)
|
|
w.int(id)
|
|
w.int(start)
|
|
w.int(end)
|
|
return w.buf
|
|
}
|
|
/// where the range is on screen: its first line's rectangle
|
|
public static func textBounds(id: Int, start: Int, end: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(58)
|
|
w.int(id)
|
|
w.int(start)
|
|
w.int(end)
|
|
return w.buf
|
|
}
|
|
/// the offset nearest a point of the window
|
|
public static func textIndexAt(id: Int, x: Double, y: Double) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(59)
|
|
w.int(id)
|
|
w.float(x)
|
|
w.float(y)
|
|
return w.buf
|
|
}
|
|
/// the keyboard went away
|
|
public static func textInputEnded(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(60)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// the accessible elements, encoded as Nodes: for each, its ID, parent, role, label, value, hint, frame and actions
|
|
public static func accessibilityTree(id: Int) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(61)
|
|
w.int(id)
|
|
return w.buf
|
|
}
|
|
/// an assistive technology's action on an element: "press", "increment", "decrement", "focus", "scrollForward", …
|
|
public static func accessibilityAction(id: Int, node: Int, action: String) -> [UInt8] {
|
|
var w = WireWriter()
|
|
w.uvarint(62)
|
|
w.int(id)
|
|
w.int(node)
|
|
w.string(action)
|
|
return w.buf
|
|
}
|
|
}
|
|
|
|
public struct BackgroundReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TerminatingReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct BackPressedReply {
|
|
public var handled: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
handled = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct WillNavigateReply {
|
|
public var allow: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
allow = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct NewWindowReply {
|
|
public var handled: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
handled = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct PermissionRequestedReply {
|
|
public var allow: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
allow = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct SurfaceDestroyedReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct KeyReply {
|
|
public var handled: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
handled = r.bool()
|
|
}
|
|
}
|
|
|
|
public struct TextReplaceReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextMarkReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextUnmarkReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextDeleteReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextSelectReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextCommandReply {
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
}
|
|
}
|
|
|
|
public struct TextStateReply {
|
|
public var text: String = ""
|
|
public var base: Int = 0
|
|
public var length: Int = 0
|
|
public var selStart: Int = 0
|
|
public var selEnd: Int = 0
|
|
public var markStart: Int = 0
|
|
public var markEnd: Int = 0
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public var width: Double = 0
|
|
public var height: Double = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
text = r.string()
|
|
base = r.int()
|
|
length = r.int()
|
|
selStart = r.int()
|
|
selEnd = r.int()
|
|
markStart = r.int()
|
|
markEnd = r.int()
|
|
x = r.float()
|
|
y = r.float()
|
|
width = r.float()
|
|
height = r.float()
|
|
}
|
|
}
|
|
|
|
public struct TextRangeReply {
|
|
public var text: String = ""
|
|
public var start: Int = 0
|
|
public var end: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
text = r.string()
|
|
start = r.int()
|
|
end = r.int()
|
|
}
|
|
}
|
|
|
|
public struct TextBoundsReply {
|
|
public var ok: Bool = false
|
|
public var x: Double = 0
|
|
public var y: Double = 0
|
|
public var width: Double = 0
|
|
public var height: Double = 0
|
|
public var end: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
ok = r.bool()
|
|
x = r.float()
|
|
y = r.float()
|
|
width = r.float()
|
|
height = r.float()
|
|
end = r.int()
|
|
}
|
|
}
|
|
|
|
public struct TextIndexAtReply {
|
|
public var ok: Bool = false
|
|
public var index: Int = 0
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
ok = r.bool()
|
|
index = r.int()
|
|
}
|
|
}
|
|
|
|
public struct AccessibilityTreeReply {
|
|
public var nodes: [UInt8] = []
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
nodes = r.bytes()
|
|
}
|
|
}
|
|
|
|
public struct AccessibilityActionReply {
|
|
public var handled: Bool = false
|
|
public init() {}
|
|
init(_ r: inout WireReader) {
|
|
handled = r.bool()
|
|
}
|
|
}
|